Guess the country

globeFor this challenge we are going to create a game where the user plays against the computer.

The aim of this game is to guess the name of a country. The computer will give the player clues to help them identify the country. The aim for the player is to try to guess the country using as few clues as possible.

For this challenge we are going to work from a flowchart that describes the algorithm we will base our code on: (Click on the picture to zoom in)


Let’s get coding

We have started the code for you. Use the flowchart above to complete this code.

Extension task #1

Could you tweak this code to display at the end how many clues have been used in total to guess the country.

Extension task #2

This code only works with one country.

How could we change it to have a list countries and a list of clues for each country and get the computer to randomly choose one country from the list of countries.

Tip: To solve this task you may want to investigate how to use a list of lists in Python.

Did you like this challenge?

Click on a star to rate it!

Average rating 3.9 / 5. Vote count: 7

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: , ,