Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.

Latest commit

 

History

History
77 lines (62 loc) · 1.59 KB

File metadata and controls

77 lines (62 loc) · 1.59 KB

#Exercise 27: Logic In this lesson we will be learning the basics of python programming logic and committing them to memory.

##The Truth Terms In Python, there are a few terms to determine whether something is "True" or "False." Logic on a computer is all about seeing if some combination of these characters and some variables are true at a certain point in the program/execution. A few of those terms will be listed below.

  • and
  • or
  • not
  • != (not equal)
  • == (equal)
  • >= (greater-than-equal)
  • <= (less-than-equal)
  • True
  • False

##The Truth Tables Here are a few applications of the truth terms, these are important to commit to memory.

NOT True?
not False True
not True False
OR True?
True or True True
True or False True
False or True True
False or False False
AND True?
True and True True
True and False False
False and True False
False and False False

popularly referred to as NOR

NOT OR True?
not (True or True) False
not (True or False) False
not (False or True) False
not (False or False) True

popularly referred to as NAND

NOT AND True?
not (True and True) False
not (True and False) True
not (False and True) True
not (False and False) True

And two more charts dealing with equality:

!= True?
1 != 1 False
1 != 0 True
0 != 1 True
0 != 0 False
== True?
1 == 1 True
1 == 0 False
0 == 1 False
0 == 0 True