
September 23rd, 2012, 05:54 PM
|
 |
Contributing User
|
|
|
|
|
The answer depends upon whether you're using python 3 or an earlier version.
In python 3 input returns a string which is never equal to the Boolean data type value True and so the else event always happens.
In python 2 input evaluates the string you type, and returns that. Thus, in python2 the entries of
True
or
1
would cause the true branch of the if statement to execute.
(or if you happen to have a variable named a with the value of 1 assigned to it you could enter a as well.)
[edit] false sentence removed [/edit]
__________________
[code] Code tags[/code] are essential for python code!
Last edited by b49P23TIvg : September 24th, 2012 at 04:10 PM.
|