June 2017
Beginner
320 pages
7h 37m
English
The logic combinations you learned from the last exercise are called Boolean logic expressions. Boolean logic is used everywhere in programming. It is a fundamental part of computation, and knowing the expressions is akin to knowing your scales in music.
In this exercise you will take the logic exercises you memorized and start trying them out in Python. Take each of these logic problems and write what you think the answer will be. In each case it will be either True or False. Once you have the answers written down, start Python in your Terminal and type each logic problem in to confirm your answers.
1. True and True
2. False and True
3. 1 == 1 and 2 == 1
4. "test" == "test"
5. 1 == 1 or 2 != 1
6. True and 1 == 1 ...
Read now
Unlock full access