ASCII Quiz Challenge

ASCII Code


The ASCII code (Pronounced ask-ee) is a code for representing English characters as numbers, with each character assigned a number from 0 to 127. For example, the ASCII code for uppercase A is 65. The extended ASCII contains 256 characters (using numbers from 0 to 255).

To see a list of the most useful ASCII codes, you can download our simplified ASCII helpsheet.

keyboard
Each character that appears on your keyboard has a unique value. This includes the 26 lowercase letters & 26 uppercase letters of the alphabet, the number digits from 0 to 9 and a range of punctuation signs and special characters.

Take the Quiz! (open full screen)


chr() and ord() functions

Using Python, you can easily access ASCII values of a character using the ord() function. And vice-versa, the chr() function is used to retrieve the character matching a given ASCII value. For instance:

  • ord(“A”) returns 65
  • chr(65) returns “A”

ASCII Quiz in Python

Your Python challenge consists of recreating the above game where the user tries to guess the ASCII value of different characters randomly selected. The difference between the user’s guess and the actual ASCII value of the character being displayed is used to decrement a life score.

The user starts the game with a life score of 255 and tries to guess as many ASCII values as possible before reaching a life score of 0. Any correct answer (exact ASCII value guessed) automatically resets the user’s life score to 255!


unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area