Codele / How computers think
Letters are numbers too
A computer cannot store a letter, only switches. So every letter is turned into a number from an agreed table, and that number is stored as switches.
- The computer keeps an agreed table: each letter has its own number. A is 65, B is 66, a is 97, and a space is 32.
- A capital and a small letter are different letters, so they have different numbers.
- The number is then stored as switches, like in the last lesson. One letter fits in 8 switches, one byte.
- The most famous table is called ASCII. Today’s tables, called Unicode, keep these numbers and add many more letters and symbols.
- In Python, ord gives the number of a letter. In JavaScript, charCodeAt does the same.
Loading the playable lesson…