Python Program to Find ASCII Value of a Character – 2024

Hey guys, in this blog we will see a Python Program to Find ASCII Value of a Character.

Code

# Python Program to Find ASCII Value of a Character

c = input('Enter a character -> ')
print(f"The ASCII value of {c} is {ord(c)}")

Output

Enter a character -> A
The ASCII value of A is 65
Enter a character -> a
The ASCII value of a is 97
Enter a character -> $
The ASCII value of $ is 36

We simply use the ord() method to convert a string to ASCII.

Check out our other python programming examples

Abhishek Sharma
Abhishek Sharma

Started my Data Science journey in my 2nd year of college and since then continuously into it because of the magical powers of ML and continuously doing projects in almost every domain of AI like ML, DL, CV, NLP.

Articles: 520

Subscribe to our Newsletter

Subscribe to our newsletter and receive all latest projects...

Leave a Reply

Your email address will not be published. Required fields are marked *