Why is this logical expression in python False?
Posted
by W3ctor
on Stack Overflow
See other posts from Stack Overflow
or by W3ctor
Published on 2010-04-11T16:16:34Z
Indexed on
2010/04/11
16:23 UTC
Read the original article
Hit count: 274
My question is, why are these expressions False?
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> num = raw_input("Choose a number: ")
Choose a number: 5
>>> print num
5
>>> print ( num < 18 )
False
>>> print ( num == 5 )
False
Because if i try this:
>>> print ( num > 0 )
True
The expression works fine.
Thank you for the help!
© Stack Overflow or respective owner