Did You Know?
The aim of the “Guess Who” game is to look at a list of character cards and to ask “Yes/No” questions to progressively eliminate cards from the set by flipping them down. At the end of the game there should only be one card still standing up. The aim is to find this card by eliminating all the others.
Learning Objectives
By Completing this challenge you will understand more about the use of boolean logic when using selection statements (if statements).
Before completing this challenge, remember that:
- == and != are comparison operators,
- == means “is equal to?”,
- != means “is not equal to?”, aka “is different from?”
- Other comparison operators can be used in selection statements such as >, <, <=, >=, but we will not use these in this challenge,
- AND and OR are boolean operators,
- The result of a comparison is a boolean, which means it’s either True or False.
Now let’s look at our set of seven “Guess Who” cards: Click on a card to flip it.
Round #1:
Look at the pseudo-code below to find out who is on the remaining card:
if gender == "Male" AND wearsGlasses == True: flipCardDown() if hairColor == "Black" OR hairColor == "Blonde": flipCardDown() if gender == "Female" AND wearsHat != True: flipCardDown() print("All cards have now been flipped down but one. Who is on the remaining card?")
Not sure? Check the solution by clicking on the card below:
Round #2:
Look at the pseudo-code below to find out who is on the remaining card:
if hasBeard == True OR wearsHelmet == True: flipCardDown() if wearsEarings == True AND wearsNecklace == True: flipCardDown() if hairColor == "Brown" OR gender == "Male": flipCardDown() print("All cards have now been flipped down but one. Who is on the remaining card?")
Not sure? Check the solution by clicking on the card below:
Round #3:
Look at the pseudo-code below to find out who is on the remaining card:
if hairColor == "Blonde" OR hairColor == "Brown": flipCardDown() if wearsGlasses == True OR wearsHat == True: flipCardDown() print("All cards have now been flipped down but one. Who is on the remaining card?")
Not sure? Check the solution by clicking on the card below:
Round #4:
Look at the pseudo-code below to find out who is on the remaining card:
if eyeColor != "Blue" AND gender == "Female": flipCardDown() if wearsHat == True OR wearsHelmet == True: flipCardDown() if wearsGlasses == True: flipCardDown() if wearsTie == True : flipCardDown() print("All cards have now been flipped down but one. Who is on the remaining card?")
Not sure? Check the solution by clicking on the card below:
Round #5: Your Turn!
Select one of the character and create your own pseudo-code. Ask one of your classmate to guess which card you picked by analysing your pseudo-code.
Type your pseudo-code in the textbox below: