0
0
Intro to Computingfundamentals~10 mins

How text is stored (ASCII, Unicode) in Intro to Computing - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to convert the character 'A' to its ASCII number.

Intro to Computing
ascii_value = ord([1])
Drag options to blanks, or click blank then click option'
A"A"
BA
C'A'
D'a'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the character without quotes causes an error.
Using double quotes is also correct but only one option is correct here.
2fill in blank
medium

Complete the code to convert the ASCII number 66 back to its character.

Intro to Computing
char = chr([1])
Drag options to blanks, or click blank then click option'
A66
B"66"
C'66'
Dchr
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a string like '66' causes a TypeError.
Passing the function name instead of a number causes an error.
3fill in blank
hard

Fix the error in the code that tries to get the ASCII code of the string 'Hello'.

Intro to Computing
code = ord([1])
Drag options to blanks, or click blank then click option'
A'Hello'
B"Hello"
CHello
D'H'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the whole string causes a TypeError.
Not using quotes around the character causes an error.
4fill in blank
hard

Fill both blanks to create a dictionary mapping each character in 'abc' to its ASCII code.

Intro to Computing
ascii_map = { [1] for [2] in 'abc' }
Drag options to blanks, or click blank then click option'
A{char: ord(char)}
Bchar
Cc
Dx
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names in the loop.
Missing the colon between key and value in the dictionary.
5fill in blank
hard

Fill all three blanks to create a dictionary of characters and their Unicode codes for 'ñöç'.

Intro to Computing
unicode_map = { [1]: [2] for [3] in 'ñöç' }
Drag options to blanks, or click blank then click option'
Ach
Bord(ch)
Dchar
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not calling ord() correctly.