Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 10 Online
OpenStudy (anonymous):

Hi all...I am using python 3.2 ...there is an error when i type raw_input it says not defined...anyone have a clue??? thanks

OpenStudy (anonymous):

maybe your variable is not defined...

OpenStudy (anonymous):

>>> x = raw_input (" enter youe first name ") Traceback (most recent call last): File "<pyshell#29>", line 1, in <module> x = raw_input (" enter youe first name ") NameError: name 'raw_input' is not defined

OpenStudy (anonymous):

you must declare your variable first, maybe x as string

OpenStudy (anonymous):

>>> "x" = raw_input ("enter your first name " ) SyntaxError: can't assign to literal how to do that please.

OpenStudy (anonymous):

In python3.2 you can simply write x=input('Enter your first name\n') and if you need integers, y=int(input('Your age\n'))

OpenStudy (anonymous):

Yes it worked...thanks a lot

OpenStudy (anonymous):

If you are going to use 3.x instead of 2.x as the course instructions stipulated you should be prepared to figure out the differences between 3.x and 2.x ... 3.x is NOT backward compatible

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!