1/22/2014

(Python study) boolean (example)

>>> isRight = False         
>>> type(isRight)       
< type 'bool'>
>>> 1<2            
True
>>> 1 != 2         
True
>>> 1 == 2         
False
>>> True and False 
False
>>> True & True    
True
>>> False | False
False
>>> not True
False
>>> 
>>> bool(0)
False
>>> bool(-1)
True
>>> bool('test')
True
>>> bool(None)
False
>>>     

No comments:

Post a Comment