Weekly Challenge #9 – Which is higher?

This week we are building a basic quiz game which will ask the user to identify which of two statistics is higher. For example:

“Which is higher? The population of England OR The population of Portugal?”

These questions will be dynamically generated from a pre-defined list of statistics.

Bronze

Design a program which stores a series of statistics. You will need to give each statistic a description, along with a value. For example:

Statistic: The population of England

Value: 53,000,000

Hint

You can do this using two arrays/lists (One for the descriptions, one for the values). Alternatively, you could use Structs/Classes if you’re familiar with them.

[collapse]

Silver

Extend your program so that it now randomly outputs the description of two statistics, and asks the user to guess which is higher. Your program should then output whether or not the user was correct, along with the values of each statistic.

For example:

Which is higher?

A) The population of England
    OR
B) Neymar's annual salary in Euros

Enter your choice: A
CORRECT
The population of England: 53,000,000
Neymar's annual salary in Euros: 36,800,000
Hint

You’ll need to randomly select two items from your list of descriptions. This might help – http://tobybirkinshaw.com/resources/python/random-items-from-a-list-in-python-3/

[collapse]

Gold

Extend your program so that it now features a main menu. There should be an option for users to Play Game, Add a Statistic and Exit. You should implement the ability for users to add their own statistics to the game.

Hint

Adding statistics may prove difficult if you’re using a static data structure such as a C# Array. Consider using Lists so that you may append items to an existing list.

[collapse]

Platinum

Further extend your program so that statistics are saved and loaded from a text file. You may use JSON if you’re feeling particularly adventurous.