Weekly Challenge #11 – Hexadecimal Quiz

(It turns out that my definition of “weekly” differs from most…)

This week’s challenge follows on from Week #10, except this time we will be testing the user’s knowledge of hexadecimal numbers. I highly recommend attempting Week #10 before beginning this one, as many of the techniques covered in that challenge are also applicable here.

Bronze

Develop a program which will output a random 2 digit hexadecimal number. Your program should then ask the user to convert the number into decimal. Inform the user whether they have guessed correctly or incorrectly.

You are converting from hexadecimal to decimal.
The hexadecimal number is 2B
Please enter this number as a decimal number:

Silver

Extend your program so that it may instead randomly output a decimal number between 0-255. Your program should ask the user to convert this decimal number into hexadecimal. Inform the user whether they have guessed correctly or incorrectly. 

You are converting from decimal to hexadecimal.
The decimal number is: 56
Please enter this number as a 2 digit hexadecimal number:

Gold

Extend your program further so that the user is repeatedly asked questions until they answer incorrectly. The user’s score should be tracked, and the highest score should be stored in a text file.

Platinum

Utilising your code from Week #10, extend your program so that it may also randomly ask the user to convert from Binary –> Hexadecimal and vice-versa.