Jun-16-2018, 12:55 PM
There is a trick you can use to change any value to True or false:
λ python Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x = 'Hello' >>> not not x True >>> x = 0 >>> not not x False >>>so when you write a statement like:
if result == 0: return True else: return Falseit can be shortened to:
return not not resultwhich will return True or False