Python program to find ASCII values of a character

ASCII value of  character in Python

Here, in this page we will discuss program to find the ASCII value of a character in Python. The machine doesn’t have the capacity to understand languages that humans do, the machine understands binary language and converts everything to binary format. According to The American Standard Code for Information Interchange[ASCII] every number, character or any special symbol has a unique value and are ranging from 0 to 127

  • 0 t0 31 and 127:- End of File/Stream
  • 32 to 126:- Printable Characters

Characters ranging from 32 to 126 includes uppercase
alphabets, lowercase alphabets, numeric digit from 0-9 and all special characters

ASCII value of a character in python

Did You Know?

ASCII or American Standard Code for Information Interchange is a binary code which is used by electronic equipment for electronic communications . A total of 128 character have been assigned values from 0-127
Between 65 to 90 and between 97 to 122 for Alphabets.
Between 48 to 57 for Digits.
All remaining for other characters.

Algorithm for Converting Character to ASCII

  • Step 1:- Start.
  • Step 2:- Use an predefined function Ord() to get ascii values.
  • Step 3:- print ascii values.
  • Step 4:- End.
ASCII value of a character

Python Program

#user input
Char = input('Enter the character :')
#convert Char to Ascii value
Asciival = ord(Char)
#print Value
print(Asciival)
Output:
Enter the character :@
64