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

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 *