Lisi wrote:
I copied and ran the following script:
[...]
What extra should I have done because the variable value came from the keyboard, and why is it different from the first example?

You can investigate this yourself:


>>> a = 12
>>> a = raw_input("please type 12")
please type 12 12
>>> a = 12
>>> b = raw_input("please type 12: ")
please type 12: 12
>>> a
12
>>> b
'12'


See the difference? Here's more of a clue:


>>> type(a)
<type 'int'>
>>> type(b)
<type 'str'>



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to