[Tutor] Simple Python Problem
alan.gauld at btinternet.com
Mon Sep 6 19:48:00 CEST 2010
"Keith Lucas" <kwl at aber.ac.uk> wrote
> What is wrong with the following, apparently almost straight out of
> Python Programming
> by Michael Dawson?
You are using Python v2, the tutorial seems to be written for v3.
There are big diffeernces in syntax between them, v3 is NOT
backwards compatible with v2.
> # Get value.
> name = input("What is your name? ")
In v2 that would be
name = raw_input("What is your name")
> Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit
> (Intel)] on win32 Type
> "copyright", "credits" or "license()" for more information.
>>>> ================================ RESTART
> What is your name? Keith
I think there is a trick in V2.7 to make it act more like v3 but
else will need to tell you what it is... :-)
Author of the Learn to Program web site
More information about the Tutor