Newbie coding question

alister alister.nospam.ware at ntlworld.com
Thu Jun 26 14:58:20 EDT 2014


On Thu, 26 Jun 2014 20:53:35 +0200, Martin S wrote:

> Hi,
> 
> I've been following the tutorial here
> http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/
> But when I get to section 1.10 there is
> 
> person = input('Enter your name: ')
> 
> However this generates an error
> 
> 
>>>> person = input('Enter your name: ')
> Enter your name: hi
> 
> Traceback (most recent call last):
>   File "<pyshell#0>", line 1, in <module>
>     person = input('Enter your name: ')
>   File "<string>", line 1, in <module>
> NameError: name 'hi' is not defined
>>>>
>>>>
> I have no idea what I am doing wrong with this - it look correct to me.
> 
> I'm obviously doing something stupid, anyone can suggest what?
> 
> /M .

As a quick guess you are using python 2.X when the tutorial is written 
for python 3.X
Input is one of the incompatible changes between 2.x & 3.x
try raw_input instead (or install Python 3)



-- 
You can't get there from here.



More information about the Python-list mailing list