[Tutor] wrong code
David Porter
jcm@bigskytel.com
Thu, 1 Mar 2001 01:05:14 -0700
* Katharine Stoner <kstoner@netins.net>:
> day = input("On a scale of 1 to 10, how was your day?")
what you want to use is raw_input(), not input(). raw_input() returns the
input as a string, while input() evaluates the input as a python expression.
Observe the following interpreter session (the 5+5 is what I typed at the
prompt):
>>> x = input("what is 10? ")
What is 10? 5+5
>>> print x
10
>>> x = raw_input("what is 10? ")
What is 10? 5+5
>>> print x
5+5
See:
http://www.python.org/doc/current/lib/built-in-funcs.html
> if day == fine:
This wont work because fine doesn't exist. What you meant was "fine" (quotes
included). "fine" is a string, while fine is a keyword.
> #used double equals to make
> print "The salad is properly cooked."
> else:
> print "Cook the salad some more."
David