conditions: True and False. Comparators, Operator,


In [15]:
#True and False are built-in constant tof Python
print True
print False
print true


True
False
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-15-9ccb1caf5946> in <module>()
      2 print True
      3 print False
----> 4 print true

NameError: name 'true' is not defined

In [13]:
#True means non-zero, Yes, Good, there is someting,
#Flase means zero, no, NG, nothing, empty


def true_or_false(a):
    if a:
        print "\"",str(a),"\"", " is defined as True"
        return True
    else:
        print "\"",str(a),"\"", " is defined as False"
        return False
true_or_false('a')
true_or_false('')
true_or_false([])
true_or_false([2,3])
true_or_false([[]])
true_or_false([[]][0])  #we index 0 of the component which turn out to be [].


True
False
" a "  is defined as True
"  "  is defined as False
" [] "  is defined as False
" [2, 3] "  is defined as True
" [[]] "  is defined as True
" [] "  is defined as False
Out[13]:
False

In [ ]: