Trick Questions
What does a yellow stone thrown into a blue pond become? Do they have a 4th of July in England? How can a doctor go 30 days without sleep? Whatever you think the answers to these trick questions are, you’re probably wrong. The 54 questions in this program have been specifically crafted so that their answers are simple, obvious, and misleading. Finding the true answer will require some cleverness.
Copying the code from this book will spoil the fun, since you’ll see the answers, so you might want to download and play this game from https://inventwithpython.com/trickquestions.py before looking at the source code.
trick_questions.py
1"""Trick Questions, by Al Sweigart al@inventwithpython.com
2A quiz of several trick questions.
3This code is available at https://nostarch.com/big-book-small-python-programming
4Tags: large, humor"""
5
6import random, sys
7
8# QUESTIONS is a list of dictionaries, each dictionary represents a
9# trick question and its answer. The dictionary has the keys 'question'
10# (which holds the text of the question), 'answer' (which holds the text
11# of the answer), and 'accept' (which holds a list of strings that, if
12# the player's answer contains any of, they've answered correctly).
13# (!) Try coming up with your own trick questions to add here:
14QUESTIONS = [
15 {'question': "How many times can you take 2 apples from a pile of 10 apples?",
16 'answer': "Once. Then you have a pile of 8 apples.",
17 'accept': ['once', 'one', '1']},
18 {'question': 'What begins with "e" and ends with "e" but only has one letter in it?',
19 'answer': "An envelope.",
20 'accept': ['envelope']},
21 {'question': "Is it possible to draw a square with three sides?",
22 'answer': "Yes. All squares have three sides. They also have a fourth side.",
23 'accept': ['yes']},
24 {'question': "How many times can a piece of paper be folded in half by hand without unfolding?",
25 'answer': "Once. Then you are folding it in quarters.",
26 'accept': ['one', '1', 'once']},
27 {'question': "What does a towel get as it dries?",
28 'answer': "Wet.",
29 'accept': ['wet']},
30 {'question': "What does a towel get as it dries?",
31 'answer': "Drier.",
32 'accept': ['drier', 'dry']},
33 {'question': "Imagine you are in a haunted house full of evil ghosts. What do you have to do to stay safe?",
34 'answer': "Nothing. You're only imagining it.",
35 'accept': ['nothing', 'stop']},
36{'question': "A taxi driver is going the wrong way down a one-way street. She passes ten cops but doesn't get a ticket. Why not?",
37 'answer': "She was walking.",
38 'accept': ['walk']},
39 {'question': "What does a yellow stone thrown into a blue pond become?",
40 'answer': "Wet.",
41 'accept': ['wet']},
42 {'question': "How many miles does must a cyclist bike to get to training?",
43 'answer': "None. They're training as soon as they get on the bike.",
44 'accept': ['none', 'zero', '0']},
45 {'question': "What building do people want to leave as soon as they enter?",
46 'answer': "An airport.",
47 'accept': ['airport', 'bus', 'port', 'train', 'station', 'stop']},
48 {'question': "If you're in the middle of a square house facing the west side with the south side to your left and the north side to your right, which side of the house are you next to?",
49 'answer': "None. You're in the middle.",
50 'accept': ['none', 'middle', 'not', 'any']},
51 {'question': "How much dirt is in a hole 3 meters wide, 3 meters long, and 3 meters deep?",
52 'answer': "There is no dirt in a hole.",
53 'accept': ['no', 'none', 'zero']},
54 {'question': "A girl mails a letter from America to Japan. How many miles did the stamp move?",
55 'answer': "Zero. The stamp was in the same place on the envelope the whole time.",
56 'accept': ['zero', '0', 'none', 'no']},
57 {'question': "What was the highest mountain on Earth the day before Mount Everest was discovered?",
58 'answer': "Mount Everest was still the highest mountain of Earth the day before it was discovered.",
59 'accept': ['everest']},
60 {'question': "How many fingers do most people have on their two hands?",
61 'answer': "Eight. They also have two thumbs.",
62 'accept': ['eight', '8']},
63 {'question': "The 4th of July is a holiday in America. Do they have a 4th of July in England?",
64 'answer': "Yes. All countries have a 4th of July on their calendar.",
65 'accept': ['yes']},
66 {'question': "Which letter of the alphabet makes honey?",
67 'answer': "None. A bee is an insect, not a letter.",
68 'accept': ['no', 'none', 'not']},
69 {'question': "How can a doctor go 30 days without sleep?",
70 'answer': "By sleeping at night.",
71 'accept': ['night', 'evening']},
72 {'question': "How many months have 28 days?",
73 'answer': "12. All months have 28 days. Some have more days as well.",
74 'accept': ['12', 'twelve', 'all']},
75 {'question': "How many two cent stamps are in a dozen?",
76 'answer': "A dozen.",
77 'accept': ['12', 'twelve', 'dozen']},
78 {'question': "Why is it illegal for a person living in North Dakota to be buried in South Dakota?",
79 'answer': "Because it is illegal to bury someone alive.",
80 'accept': ['alive', 'living', 'live']},
81 {'question': "How many heads does a two-headed coin have?",
82 'answer': "Zero. Coins are just circular pieces of metal. They don't have heads.",
83 'accept': ['zero', 'none', 'no', '0']},
84 {'question': "What kind of vehicle has four wheels and flies?",
85 'answer': "A garbage truck.",
86 'accept': ['garbage', 'dump', 'trash']},
87 {'question': "What kind of vehicle has four wheels and flies?",
88 'answer': "An airplane.",
89 'accept': ['airplane', 'plane']},
90 {'question': "What five-letter word becomes shorter by adding two letters?",
91 'answer': "Short.",
92 'accept': ['short']},
93 {'question': "Gwen's mother has five daughters. Four are named Haha, Hehe, Hihi, and Hoho. What's the fifth daughter's name?",
94 'answer': "Gwen.",
95 'accept': ['gwen']},
96 {'question': "How long is a fence if there are three fence posts each one meter apart?",
97 'answer': "Two meters long.",
98 'accept': ['2', 'two']},
99 {'question': "How many legs does a dog have if you count its tail as a leg?",
100 'answer': "Four. Calling a tail a leg doesn't make it one.",
101 'accept': ['four', '4']},
102 {'question': "How much more are 1976 pennies worth compared to 1975 pennies?",
103 'answer': "One cent.",
104 'accept': ['1', 'one']},
105 {'question': "What two things can you never eat for breakfast?",
106 'answer': "Lunch and dinner.",
107 'accept': ['lunch', 'dinner', 'supper']},
108 {'question': "How many birthdays does the average person have?",
109 'answer': "One. You're only born once.",
110 'accept': ['one', '1', 'once' 'born']},
111 {'question': "Where was the United States Declaration of Independence signed?",
112 'answer': "It was signed at the bottom.",
113 'accept': ['bottom']},
114 {'question': "A person puts two walnuts in their pocket but only has one thing in their pocket five minutes later. What is it?",
115 'answer': "A hole.",
116 'accept': ['hole']},
117 {'question': "What did the sculptor make that no one could see?",
118 'answer': "Noise.",
119 'accept': ['noise']},
120 {'question': "If you drop a raw egg on a concrete floor, will it crack?",
121 'answer': "No. Concrete is very hard to crack.",
122 'accept': ['no']},
123 {'question': "If it takes ten people ten hours to build a fence, how many hours does it take five people to build it?",
124 'answer': "Zero. It's already built.",
125 'accept': ['zero', 'no', '0', 'already', 'built']},
126 {'question': "Which is heavier, 100 pounds of rocks or 100 pounds of feathers?",
127 'answer': "Neither. They weigh the same.",
128 'accept': ['neither', 'none', 'no', 'same', 'even', 'balance']},
129 {'question': "What do you have to do to survive being bitten by a poisonous snake?",
130 'answer': "Nothing. Only venomous snakes are deadly.",
131 'accept': ['nothing', 'anything']},
132 {'question': "What three consecutive days don't include Sunday, Wednesday, or Friday?",
133 'answer': "Yesterday, today, and tomorrow.",
134 'accept': ['yesterday', 'today', 'tomorrow']},
135 {'question': "If there are ten apples and you take away two, how many do you have?",
136 'answer': "Two.",
137 'accept': ['2', 'two']},
138 {'question': "A 39 year old person was born on the 22nd of February. What year is their birthday?",
139 'answer': "Their birthday is on February 22nd of every year.",
140 'accept': ['every', 'each']},
141 {'question': "How far can you walk in the woods?",
142 'answer': "Halfway. Then you are walking out of the woods.",
143 'accept': ['half', '1/2']},
144 {'question': "Can a man marry his widow's sister?",
145 'answer': "No, because he's dead.",
146 'accept': ['no']},
147 {'question': "What do you get if you divide one hundred by half?",
148 'answer': "One hundred divided by half is two hundred. One hundred divided by two is fifty.",
149 'accept': ['two', '200']},
150 {'question': "What do you call someone who always knows where their spouse is?",
151 'answer': "A widow or widower.",
152 'accept': ['widow', 'widower']},
153 {'question': "How can someone take a photo but not be a photographer?",
154 'answer': "They can be a thief.",
155 'accept': ['thief', 'steal', 'take', 'literal']},
156 {'question': "An electric train leaves the windy city of Chicago at 4pm on a Monday heading south at 100 kilometers per hour. Which way does the smoke blow from the smokestack?",
157 'answer': "Electric trains don't have smokestacks.",
158 'accept': ["don't", "doesn't", 'not', 'no', 'none']},
159 {'question': 'What is the only word that rhymes with "orange"?',
160 'answer': "Orange.",
161 'accept': ['orange']},
162 {'question': "Who is the U.S. President if the U.S. Vice President dies?",
163 'answer': "The current U.S. President.",
164 'accept': ['president', 'current', 'already']},
165 {'question': "A doctor gives you three pills with instructions to take one every half-hour. How long will the pills last?",
166 'answer': "One hour.",
167 'accept': ['1', 'one']},
168 {'question': "Where is there an ocean with no water?",
169 'answer': "On a map.",
170 'accept': ['map']},
171 {'question': "What is the size of a rhino but weighs nothing?",
172 'answer': "A rhino's shadow.",
173 'accept': ['shadow']},
174 {'question': "The clerk at a butcher shop is exactly 177 centimeters tall. What do they weigh?",
175 'answer': "The clerk weighs meat.",
176 'accept': ['meat']}]
177
178CORRECT_TEXT = ['Correct!', 'That is right.', "You're right.",
179 'You got it.', 'Righto!']
180INCORRECT_TEXT = ['Incorrect!', "Nope, that isn't it.", 'Nope.',
181 'Not quite.', 'You missed it.']
182
183print('''Trick Questions, by Al Sweigart al@inventwithpython.com
184
185Can you figure out the answers to these trick questions?
186(Enter QUIT to quit at any time.)
187''')
188
189input('Press Enter to begin...')
190
191random.shuffle(QUESTIONS)
192score = 0
193
194for questionNumber, qa in enumerate(QUESTIONS): # Main program loop.
195 print('\n' * 40) # "Clear" the screen.
196 print('Question:', questionNumber + 1)
197 print('Score:', score, '/', len(QUESTIONS))
198 print('QUESTION:', qa['question'])
199 response = input(' ANSWER: ').lower()
200
201 if response == 'quit':
202 print('Thanks for playing!')
203 sys.exit()
204
205 correct = False
206 for acceptanceWord in qa['accept']:
207 if acceptanceWord in response:
208 correct = True
209
210 if correct:
211 text = random.choice(CORRECT_TEXT)
212 print(text, qa['answer'])
213 score += 1
214 else:
215 text = random.choice(INCORRECT_TEXT)
216 print(text, 'The answer is:', qa['answer'])
217 response = input('Press Enter for the next question...').lower()
218
219 if response == 'quit':
220 print('Thanks for playing!')
221 sys.exit()
222
223print("That's all the questions. Thanks for playing!")