In this challenge, you will create a computer program to ask the end-user to try to guess the top 10 largest countries per area.
To do so you will use a list in Python, containing the top 10 countries as follows:
#Top 10 largest countries in the world per area largestCountries = ["Russia","Canada","USA","China","Brazil","Australia","India","Argentina","Kazakhstan","Algeria"]
Using this list, what do you think would be the values of:
- largestCountries[0],
- largestCountries[2],
- largestCountries[9]?
We have started the code by asking the user to enter the name of a country and checking whether or not this country is in the top ten list.
Your aim is to tweak this code to allow the user to name as many countries as they wish. Each time they get one country from the top 10 list, they score one point. The end-user should not need to list the ten countries in the right order. However the user should not score additional points by naming the same country more than once.
The program should stop if the user has guessed all 10 countries or when the user presses “x” to quit the game.
Extension Task
Use the time library and use a timer to give a maximum of 60 seconds for the user to guess all ten countries.
Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area