August 2021
Beginner to intermediate
118 pages
1h 29m
English
| Puzzle 14 | The Great Divide |
| | def div(a, b): |
| | return a / b |
| | |
| | |
| | if div(1, 2) > 0 or div(1, 0) > 0: |
| | print('OK') |
| | else: |
| | print('oopsie') |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: OK
You probably expected this code to raise ZeroDivisionErro due to div(1, 0).
If you call div(1, 0) by itself, you will see the exception. Yet the logic operators in Python, and and ...
Read now
Unlock full access