Clues
Has crumbs? Was at home? Each clue is True or False.
06TRUE OR FALSE? ยท CHALLENGES
Mix comparisons, and, or, not, and in to solve small mysteries. Parentheses keep long questions clear.
IN REAL LIFE
Each clue is a small question. Together they solve the case.
Has crumbs? Was at home? Each clue is True or False.
You ride if you are tall enough and you have a ticket.
You get in if you know the password and your name is on the list.
LOOK FIRST
Whatever is inside ( ) is answered before anything else.
Comparisons like age > 8 and searches like "a" in word become True or False.
not flips the answer right next to it.
and goes before or. True or False and False is True, because False and False is done first.
A trick: When a question gets long, add ( ). Then you and Python read it the same way.
STEP BY STEP
Follow the clues one at a time, like Python.
has_crumbs = TrueMax has crumbs on the shirt.was_home = TrueMax was at home, next to the cake.has_alibi = FalseNobody saw Max somewhere else.if has_crumbs and was_home and not has_alibi:not has_alibi: flip False into True. Then True and True and True: all True. print("Max ate the cake!")Every clue agrees, so this path runs. Case closed!RUN IT
Guess first. Then run real Python and check.
name = "Leo"
crumbs = ["Leo", "Mia"]
at_park = ["Mia", "Ana"]
if name in crumbs and name not in at_park:
print(name + " ate the cookie!")
else:
print(name + " is innocent")What will Python show?
PyBot's hint
Ready. Press Run Python.
Pyodide 314.0.3 runs CPython in your browser with WebAssembly.
Open-source under the Mozilla Public License 2.0. License
Now change one thing: Change name to "Mia". Is Mia innocent? Then try "Ana".
YOUR TURN
Try each tiny question. A wrong answer becomes something to review.
Who matches both clues?
age = 9
age >= 8 and age <= 10What does Python answer?
True or False and FalseWhat does Python answer?
(True or False) and FalseWhat does Python answer?
pets = ["cat", "dog"]
"cat" in pets and "fish" not in petsWhat does Python answer?
password = "pybot"
day = "Monday"
vip = True
password == "pybot" and (day == "Saturday" or vip)Does the door open? (What does Python answer?)
not (age < 8)Which one always gives the same answer?
The ride is closed today, but PyBot's code still lets a small kid in. and goes before or. Add ( ) so the ride must be open.
closed todayOUTPUT
Want a fresh start? Clear only this page.
Next, you will pack it all inside a box with a name.