Characters, ord & chr Tricks
Convert letters to numbers and back.
Letters Are Numbers
Every character your program reads is stored as a number under the hood. Knowing that code point lets you do math on letters. 🔢
Meet ord()
The ord() function turns a single character into its integer code point. It is your bridge from letters into arithmetic.
print(ord('A')) # 65
print(ord('a')) # 97All lessons in this course
- Characters, ord & chr Tricks
- Count Letters with a Frequency Table
- Palindrome Checks Done Right
- Split, Strip & Rejoin Words