← ACARA Digital Technologies Years 7–8

ASCII codes for digits, spaces and punctuation

The text character '5' has ASCII code 53, not 5. Digits '0' to '9' are codes 48 to 57 and a space is 32, so a typed number is stored as text.

Understanding ASCII codes for digits, spaces and punctuation in ACARA Digital Technologies Years 7–8

What it does: The digits start at 48 for '0' and count up one at a time to 57 for '9'. Typing 42 stores two characters: '4' (code 52) and '2' (code 50). They are text codes, not the number 42. A space is a real character and has code 32. It is not stored as nothing or zero. Code 0 is a special control code, not the digit. The digit character '0' starts the digit codes at 48. The space counts as a character. The codes are 65, 32 and 49. The digits count up from 48, so '9' is 48 + 9 = 57.

Common mistakes: The code for '7' is 55. To get the number 7 you subtract 48, the code for '0', not 32, which is the code for a space. A space is a character with ASCII code 32, so the check must be ord(b) == 32. Code 0 is not a space.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 128–152) and word search (Modules 69–152).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What is the ASCII code of the character '5'?
535
Matches
'7' = 7
↓
The character '7' has ASCII code 55, not 7. The code is not the same as the number's value.
Applying
Meanings
Term
'5' = 53
Meaning
The text character '5' has ASCII code 53, not 5. Digits '0' to '9' are codes 48 to 57 and a space is 32, so a typed number is stored as text.
Practice
'0' = 48
Testing
Gaps
=("5")
Check Answer
Spots
3print(code)
4print(code - 32)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Sea Dragon' badge — OOP Pioneer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What is the ASCII code of the character '5'?
A. 5
B. 53 ✓
The character '5' is text, so it has its own ASCII code, 53. The number 5 is a different thing.
2. Which range of ASCII codes is used for the digit characters '0' to '9'?
A. 0 to 9
B. 48 to 57 ✓
'0' is code 48 and '9' is code 57. Codes 0 to 9 are not the digit characters.
3. What is the ASCII code for a space?
A. 32 ✓
B. 0
A space is a real character and has code 32. It is not stored as nothing or zero.
4. A student types 7 on a keyboard in a text box. How does the computer first store it?
A. As the text character '7' with code 55 ✓
B. As the number 7 in binary 00000111
A typed number arrives as text. '7' is code 55 (48 + 7), and only later can a program convert it to a number.
5. Which statement is true?
A. The character '0' has ASCII code 48 ✓
B. The character '0' has ASCII code 0
Code 0 is a special control code, not the digit. The digit character '0' starts the digit codes at 48.

Match the Pairs

'5' = 53 → The text character '5' is stored with ASCII code 53, not the number 5
' ' = 32 → A space is a character and has its own ASCII code, 32
The digit characters '0' to '9' use the ASCII codes 48 to 57 → '0' = 48, '9' = 57
A typed number such as 42 is stored as text, one character code per digit → '4' = 52, '2' = 50
'7' = 7 → The character '7' has ASCII code 55, not 7. The code is not the same as the number's value.
' ' = 0 → A space is not code 0. The space character has ASCII code 32.

Key Term

'5' = 53
The text character '5' has ASCII code 53, not 5. Digits '0' to '9' are codes 48 to 57 and a space is 32, so a typed number is stored as text.

Fill in the Blanks

1. =CODE("5")
Hint: Type the spreadsheet function that returns the ASCII code of a character.
2. =CHAR(32)
Hint: Type the ASCII code that produces a space character.
3. =CODE("0")+9
Hint: Type how many steps above the first digit the last digit is, so the result is the last digit's code.
4. =CODE("5")=53
Hint: Type the ASCII code of the text character for five, which is not the same as the number's value.
5. ="A"&CHAR(32)&"B"
Hint: Type the function that turns an ASCII code into a character, here to put a space between two letters.

Spot the Error

Question 1
A digit = '7'
B code = ord(digit)
C print(code)
D print(code - 32)
Line D — The code for '7' is 55. To get the number 7 you subtract 48, the code for '0', not 32, which is the code for a space.
Question 2
A a = '4'
B b = ' '
C print(ord(a))
D print(ord(b) == 0)
Line D — A space is a character with ASCII code 32, so the check must be ord(b) == 32. Code 0 is not a space.
Question 3
A age = input('Age? ')
B # the user types 15
C print(age + 1)
Line C — input() gives text, so age holds the characters '1' and '5'. Adding the number 1 to text causes an error. Join text with text: age + '1'.
Question 4
A ch = '9'
B print(ord(ch) == 9)
C print(ord(' ') == 32)
Line B — The character '9' has ASCII code 57, not 9. The digits '0' to '9' are codes 48 to 57.
Question 5
A num = 5
B txt = '5'
C print(ord(num) == 53)
Line C — ord() works on a text character. num is the number 5, not the character '5'. Use txt, whose character '5' has code 53.

Student with a class code? Join your class →