Stage 4 · Ministry of Walks
Booleans & Conditions
“True or False, little squire? The Ministry already knows.”The Under-Minister
Scrolls on the trail
These are the 5 lore scrolls you'll find in Ministry of Walks, in the order the lesson teaches them. The comment after each print shows what it outputs.
Lore scroll · Booleans & Conditions
Yes or No
print(3 > 2) # True
print(5 == 4) # False
print(2 != 2) # FalseA comparison gives back True or False. == asks equal?, != asks not equal?
Lore scroll · Booleans & Conditions
and, or, not
print(True and False) # False
print(True or False) # True
print(not True) # Falseand needs both sides True. or needs just one. not flips True and False.
Lore scroll · Booleans & Conditions
The Fork
heat = 4
if heat > 5: word = "melt"
elif heat > 2: word = "glow"
else: word = "cold"
print(word) # glowPython tries each branch from the top and runs only the first one that is True.
Lore scroll · Booleans & Conditions
Empty Means False
print(bool(0), bool(7)) # False True
print(bool(""), bool("a")) # False True
print(bool([]), bool([0])) # False True0, empty strings and empty lists count as False. Nearly everything else is True.
Lore scroll · Booleans & Conditions
Chains & Remainders
x = 5
print(1 < x < 9) # True
print(x % 2 == 1) # True
print(not x % 2 == 1) # False1 < x < 9 checks both sides at once. x % 2 == 1 is True for odd x. not goes last.
The stage puzzle: The truth gates
Two of the Ministry's gates, walls of glass bars too tall to jump, each stand on an if. A heat dial block in front of each gate turns heat through 0, 1, 2 and 3. The bars sink while the condition is True and rise again as soon as it turns False.
if heat > 1 and heat != 3:
gate.open()
if heat % 2 == 1 and not heat == 1:
gate.open()Show the answer
The first gate opens at heat 2. The second opens only at heat 3.
Practice the Under-Minister's trial
In the game, the Under-Minister duels you in a sealed arena. His question shows across the top of the screen, and you answer by jumping up into the lettered block, A to D, while you dodge his spells. You need 4 right answers to banish him. These are his questions, drawn from all 11 in his bank. The hints work the same as in the game: ask once for his riddle, and ask again for him to rule out a wrong answer.