Back to articles
Learn ASCII with Easy Examples in Python and JavaScript

Learn ASCII with Easy Examples in Python and JavaScript

via Dev.toHarini

What is ASCII? ASCII (American Standard Code for Information Interchange) is a character encoding system used to represent text in computers using numbers. Each character—such as letters (A–Z, a–z), digits (0–9), and symbols (@, #, etc.)—is assigned a unique numeric value called an ASCII value. Example 'A' → 65 'a' → 97 '1' → 49 '@' → 64 Why ASCII is Important Helps computers store and process text Used in programming and string manipulation Foundation for modern encoding systems like Unicode JavaScript let name = " silambu9391a@gmail.com " ; for ( let i = 0 ; i < name . length ; i ++ ) { console . log ( name [ i ] + " : " + name . charCodeAt ( i )); } How it works name[i] -> gets the character name.charCodeAt(i) -> gets ASCII value of that character Python name = " silambu9391a@gmail.com " for ch in name : print ( ch , " : " , ord ( ch )) How it works for ch in name → loops through each character ord(ch) → gives ASCII value of that character Output

Continue reading on Dev.to

Opens in a new tab

Read Full Article
3 views

Related Articles