Skip to content

Commit

Permalink
Exercise 28: Boolean Practise
Browse files Browse the repository at this point in the history
  • Loading branch information
despo committed Sep 3, 2011
1 parent 194719f commit cd10dea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions exercises/ex28.py
@@ -0,0 +1,20 @@
print "True and True should be True: %s" % (True and True)
print "False and True should be False: %s" % (False and True)
print "1 == 1 and 2 == 1 should be False: %s" % (1 == 1 and 2 == 1)
print " 'test' == 'test' should be True: %s" % ("test" == "test")
print "1 == 1 or 2 != 1 should be True: %s" % (1 == 1 or 2 != 1)
print "True and 1 == 1 should be True: %s" % (True and 1 == 1)
print "False and 0 != 0 should be False: %s" % (False and 0 != 0)
print "True or 1 == 1 should be True: %s" % (True or 1 == 1)
print " 'test' == 'testing' should be False: %s" % ("test" == "testing")
print "1 != 0 and 2 == 1 should be False: %s" % (1 != 0 and 2 == 1)
print " 'test' != 'testing' should be True: %s" % ("test" != "testing")
print " 'test' == 1 should be False: %s" % ("test" == 1)
print "not (True and False) should be True: %s" % (not (True and False))
print "not (1 == 1 and 0 != 1) should be False: %s" % (not (1 == 1 and 0 != 1))
print "not (10 == 1 or 1000 == 1000) should be False: %s" % (not (10 == 1 or 1000 == 1000))
print "not (1 != 10 or 3 == 4) should be False: %s" % (not (1 != 10 or 3 == 4))
print "not ('testing' == 'testing' and 'Zed' == 'Cool Guy') should be True: %s" % (not ("testing" == "testing" and "Zed" == "Cool Guy"))
print "1 == 1 and not ('testing' == 1 or 1 == 0) should be True: %s" % (1 == 1 and not ("testing" == 1 or 1 == 0))
print "'chunky' == 'bacon' and not (3 == 4 or 3 == 3) should be False: %s" % ("chunky" == "bacon" and not (3 == 4 or 3 == 3))
print "3 == 3 and not ('testing' == 'testing' or 'Python' == 'Fun') should be False: %s" % (3 == 3 and not ('testing' == 'testing' or 'Python' == 'Fun'))

0 comments on commit cd10dea

Please sign in to comment.