"chris Hynes" <[email protected]> wrote
I want the user to input a name, say "Chris". I know I can use the code:
name=raw_input()
I now want:
"Chris"=zeros((3,3))
so that when I type:
print Chris
This is a common misapprehension by beginners.
But let me ask you something. Since you will be writing your
program code, including the
print Chris
line, how will you know in advance what names your userrs are
going to input?
I think you will find it easier to create a dictiobnary of user names
with their associated values:
name = raw_input()
names[name] = value
name = raw_input("Which name was it?")
print names[name]
or even:
for name in names:
print names[name]
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor