#!/usr/bin/python nan = float('nan') inf = float('inf') def tell_me_the_truth(s): p = eval(s); if p: print "\'%s\' (%s) is TRUE." % (s, p) else: print "\'%s\' (%s) is FALSE." % (s, p) tell_me_the_truth('True') tell_me_the_truth('False') tell_me_the_truth('0') tell_me_the_truth('1') tell_me_the_truth('0.0') tell_me_the_truth('nan') tell_me_the_truth('nan == nan') tell_me_the_truth('inf') tell_me_the_truth('inf - 1') tell_me_the_truth('inf - inf') tell_me_the_truth('"0"') tell_me_the_truth('"0.0"') tell_me_the_truth('""') tell_me_the_truth('()') tell_me_the_truth('{}') tell_me_the_truth('[]') tell_me_the_truth('None') tell_me_the_truth('bool(None)') tell_me_the_truth('bool(1)')