Program to Print ASCII Value of Given Character in Python

ASCII value of a character in python. In the Python programming language, an ASCII value is used. In the Python programming language, this software will assist you in finding ASCII values. In the computer department, ASCII values are the most significant. In computers, telecommunications equipment, and other devices, ASCII codes represent text. While they accept a large number of additional characters, most modern character encoding schemes are based on ASCII.

a = 'D'
print("ASCII value '" + a + "' is", ord(a))

 

Output:

ASCII value ‘D’ is 68

ASCII Code Definition

ASCII is an abbreviation for American Standard Code For Information Interchange, which is a standard data-transmission code used by smaller and less powerful computers to represent both textual data letters, numbers, and punctuation marks as well as noninput-device commands. 

It is a number-representation code for 128 English characters, with each letter assigned a number ranging from 0 to 127. Uppercase M, for example, has the ASCII code 77. Most computers use ASCII codes to represent text, allowing data to be transferred from one computer to another.

Ord() Function in Python

In Python, the ord() function accepts a single-length string as an argument and returns the unicode code point representation of the passed argument. For instance, ord(‘B’) returns 66, which is the unicode code point value of the character ‘B’. In other words, given a 1-length string, the ord() function returns an integer representing the Unicode code point of the character when the argument is a Unicode object, or the value of the byte when the argument is an 8-bit string.