;

Python Program to Find an ASCII Value of Character


Tutorialsrack 22/04/2020 Python

In this Python program, we will learn how to find an ASCII Value of a Character and display the ASCII value.

ASCII stands for American Standard Code for Information Interchange. It is a character encoding standard for electronic communication. ASCII only encodes 128 characters. Each symbol in the character set can be represented by a Decimal value ranging from 0 to 127, as well as equivalent Hexadecimal and Octal values. For example, the ASCII value of the character ‘A’ is 65. 

In this program, we will use the ord() function which is used to find the ASCII value of a character. ord() function is a Built-in function of Python.

Here is the code of the program to find an ASCII Value of a Character and display it.

Python Program to Find an ASCII Value of Character
# Python Program to Find an ASCII Value of Character

# To Take the Input from the User
Character = input("Enter the Character: ")

print("The ASCII value of '" + Character + "' is", ord(Character))
Output

Enter the Character: a

The ASCII value of 'a' is 97

 

Enter the Character: 5

The ASCII value of '5' is 53

 

Enter the Character: #

The ASCII value of '#' is 35


Related Posts



Comments

Recent Posts
Tags