Game Development Reference
In-Depth Information
Don't add the numbers down the left side of the program, those just appear in this topic
to make the program's explanation easier to understand. The function calls in bold are the
function calls that are evaluated.
truefalsefizz.py
This code can be downloaded from http://inventwithpython.com/truefalsefizz.py
If you get errors after typing this code in, compare it to the topic's code with the online
diff tool at http://inventwithpython.com/diff or email the author at
al@inventwithpython.com
1. def TrueFizz(message):
2. print(message)
3. return True
4.
5. def FalseFizz(message):
6. print(message)
7. return False
8.
9. if FalseFizz('Cats') or TrueFizz('Dogs') :
10. print('Step 1')
11.
12. if TrueFizz('Hello') or TrueFizz('Goodbye'):
13. print('Step 2')
14.
15. if TrueFizz('Spam') and TrueFizz('Cheese') :
16. print('Step 3')
17.
18. if FalseFizz('Red') and TrueFizz('Blue'):
19. print('Step 4')
When you run this program, you can see the output (the letters on the left side have been
added to make the output's explanation easier to understand):
A. Cats
B. Dogs
C. Step 1
D. Hello
E. Step 2
F. Spam
G. Cheese
H. Step 3
I. Red
Search WWH ::




Custom Search