Python Program to Find ASCII Value of Character Ad Sponsored

ⓘ Sponsored by

ASCII stands for American Standard Code for Information Interchange. It is a character encoding standard used to represent text in computers and other devices that use digital communications. ASCII assigns a unique numeric value to each character or symbol, including letters, numbers, punctuation, and control codes.

The ASCII standard uses 7-bit binary codes to represent each character, with a total of 128 possible characters. This includes the letters A-Z (uppercase and lowercase), the digits 0-9, common punctuation marks, and control codes such as carriage return, line feed, and tab.

Python Code :

The below Python program finds the ASCII value of a character:

# take input from user
char = input("Enter a character: ")

# find the ASCII value of the character using ord() function
ascii_value = ord(char)

# print the ASCII value
print("The ASCII value of", char, "is", ascii_value)

In this program, we first take input from the user for the character whose ASCII value is to be found. We then use the built-in function ord() to find the ASCII value of the character.

Finally, we print the ASCII value of the character using the print() function. The output will be in the format of “The ASCII value of (character) is (ASCII value)”.

For example :

Enter a character: X
The ASCII value of X is 88 Ad Sponsored

ⓘ Sponsored by