Data representation · GCSE · OCR J277 1.2.4, AQA 8525 3.3.5, Edexcel 1CP2 2.2.1 · about 12 min
Character sets, bits per character, and why Unicode was needed.
[1 mark]How many characters can 7-bit ASCII represent?
[1 mark]Why was Unicode needed?
[1 mark]ord('A') is 65. What is ord('D')?
[1 mark]A 12-character message is stored in 7-bit ASCII. How many bits is it?
[1 mark]What does this program print?
print(len("robot".encode("utf-8")), len("机器人".encode("utf-8")))For the message BugBot says hi, print three lines: characters: <n>, ascii bits: <n> for 7-bit ASCII, and utf-8 bytes: <n>. Then print the 7-bit binary code of each of its first three characters, one per line, such as B 1000010. Work everything out from the message.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() message = "BugBot says hi"
Plan your program here, then type it in and press Run.