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)

GuessTheCountry

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.

Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with: , ,

Our Latest Book

Follow this blog