In [15]:
#True and False are built-in constant tof Python
print True
print False
print true
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 [].
Out[13]:
In [ ]: