Back to the animated explainer guide

How to animate an ASCII character to a byte

Uppercase A has the decimal ASCII value 65. In an eight-bit byte, that value is 01000001. ASCII uses seven bits; the leading zero pads the value to eight bits.

Check the values before animating

Check the values with Python

Run this snippet in Python 3 before building the scene. It checks the decimal value and eight-bit display, then converts the bits back to the original character.

glyph = "A"
value = ord(glyph)
bits = format(value, "08b")
assert (value, bits) == (65, "01000001")
assert chr(int(bits, 2)) == glyph
print(glyph, value, bits)

Expected output: A 65 01000001.

Plan four shots in fixed columns

  1. Set up three columns: Glyph, Decimal ASCII, and Eight-bit binary. Reveal A in the first column, and leave the other two cells blank.
  2. Reveal 65 under Decimal ASCII. Keep A visible in its original position.
  3. Reveal 01000001 under Eight-bit binary. Keep the leading zero visible and leave the first two values in place.
  4. Hold the completed row. Pause the animation and compare all three values with the Python output before recording narration.

View the ASCII from Letter to Byte Skill reference