Unicode and emoji

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Unicode and emoji

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement about Unicode is correct?
A Unicode gives a unique number to characters from many languages and to emoji
B Unicode only gives numbers to English letters and digits
2. Why is ASCII not enough for the whole world?
A It can only be read by old computers
B Its small table has too few codes for all the languages and emoji
3. How does a phone store the emoji 😀 in a message?
A As a tiny photo saved inside the text
B As a number, just like every other character
4. A friend sends a message in Japanese. Which system can store those characters?
A Unicode
B Standard ASCII
5. Which is true about Unicode and ASCII?
A Unicode includes far more characters than ASCII
B ASCII includes far more characters than Unicode

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1ord('A') AASCII is too small to cover emoji and many languages. Unicode is the system that has numbers for them.
2U+1F600 BGives the Unicode number for the character A, which is 65
3Unicode can give a number to an emoji, so a computer stores it just like a letter Cord('A') < 128
4ASCII only has 128 characters, which is far too small for all the world's languages and emoji DEmoji are stored as numbers, just like letters. The device uses the Unicode number to draw the right picture.
5ASCII has a number for every emoji and every language Echr(128512)
6An emoji is stored as a tiny picture, not a number FThe Unicode code point for the grinning face emoji

Definitions

Unicode

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
print(___("A"))
2.
print(___(65))
3.
print(ord("A") __ 65)
4.
smile = 128512 print(chr(_____))
5.
ch = "A" if ord(ch) _ 127: print("Needs Unicode")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A letter = "A"
B code = chr(letter)
C print(code)
D # prints 65
Question 2
A smile = ord(128512)
B print(smile)
C # shows a smiling emoji
Question 3
A emoji_code = 128512
B max_ascii = 255
C fits = emoji_code <= max_ascii
D print(fits)
E # False: ASCII cannot store it
Question 4
A bits_ascii = 8
B count = 2 ** bits_ascii
C print(count)
D # prints 128
Question 5
A emojis = ["😀", "🐱", "🍕"]
B for e in emojis:
C code = ord(e)
D print(e, chr(e))

Answer Key

Unicode and emoji
Section A: Quick Questions
Q1
A — Unicode gives a unique number to characters from many languages and to emoji
Q2
B — Its small table has too few codes for all the languages and emoji
Q3
B — As a number, just like every other character
Q4
A — Unicode
Q5
A — Unicode includes far more characters than ASCII
Section B: Match the Pairs
Q1
ord('A') → Gives the Unicode number for the character A, which is 65
Q2
U+1F600 → The Unicode code point for the grinning face emoji
Q3
Unicode can give a number to an emoji, so a computer stores it just like a letter → chr(128512)
Q4
ASCII only has 128 characters, which is far too small for all the world's languages and emoji → ord('A') < 128
Q5
ASCII has a number for every emoji and every language → ASCII is too small to cover emoji and many languages. Unicode is the system that has numbers for them.
Q6
An emoji is stored as a tiny picture, not a number → Emoji are stored as numbers, just like letters. The device uses the Unicode number to draw the right picture.
Section C: Definitions
Q1
Unicode — A system that gives every character a unique number, including letters from many languages and emoji, so it covers far more than the small ASCII table.
Section D: Fill in the Blanks
Q1
print(ord("A"))
Q2
print(chr(65))
Q3
print(ord("A") == 65)
Q4
smile = 128512 print(chr(smile))
Q5
ch = "A" if ord(ch) > 127: print("Needs Unicode")
Section E: Spot the Error
Q1
B — chr() turns a number into a character, but letter holds a character. To get the character's Unicode number, use ord(letter).
Q2
A — ord() changes a character into a number, but 128512 is already a number. To turn the Unicode number into an emoji, use chr(128512).
Q3
B — Standard ASCII only has codes 0 to 127, so max_ascii should be 127. That is why ASCII cannot hold an emoji code like 128512.
Q4
A — ASCII uses 7 bits, which gives 2 ** 7 = 128 characters. With 8 bits the program would print 256, not 128. This small table is why Unicode was needed.
Q5
D — chr() needs a number, but e is an emoji character, so this causes an error. To show the emoji with its Unicode number, print(e, code).