Your Turn: Print ASCII Chart

You can print your own list of printable ASCII characters with the next example script.

Example script: chars_in_strings_your_turn

  • Enter, name, and save characters_in_strings_your_turn.  
  • Click the Send to micro:bit button.
# chars_in_strings_your_turn

from microbit import *

sleep(1000)

print("ASCII")
print("Code     Character")
for n in range(32, 127):
    c = chr(n)
    print(n, "     ", c)
    sleep(250)
  • Check the results in the serial monitor.
  • Verify that it prints all the printable characters, starting from 32 space (which actually won't visibly display) to 126 ~.