Understanding ASCII Values in
Python
Basics, Usage, and Examples
What is ASCII?
• - ASCII = American Standard Code for
Information Interchange
• - Represents characters using numbers (0 to
127)
• - Each letter, digit, and symbol has a unique
numeric code
Why Use ASCII?
• - Easy text encoding in computers
• - Used in file processing, communication
protocols
• - Basis for Unicode
ASCII Table Snapshot
• Char ASCII Char ASCII
• A 65 a 97
• B 66 b 98
• 0 48 9 57
• @ 64 $ 36
ASCII in Python
• # Get ASCII value
• print(ord('A')) # 65
• # Get character from ASCII
• print(chr(65)) # 'A'
Practice Example
• for i in range(65, 91):
• print(chr(i), '=', i)
• Output: A = 65, B = 66, ..., Z = 90
Applications
• - Text encoding
• - Cryptography
• - Programming logic
• - File format processing
Summary
• - ASCII maps characters to numbers
• - Python uses ord() and chr()
• - Essential for text processing
Thank You
• Any Questions?
• Name: Anuj Tiwari