Python Program to Find ASCII Value of a Character
In this program, we will discuss how to find the ASCII value of a character using the Python programming language.
What is ASCII value?
It stands for American Standard Code for Information Interchange which is a numerical representation of characters in computers ranging from 0 to 127.
A character variable holds ASCII value rather than that character itself in Python programming language.
For example, Character ‘A’ is represented by 65.
What this means is that, if you assign ‘A’ to a character variable, 65 is stored in that variable rather than ‘A’ itself.
Python Programming Code to find the ASCII value of a character
In this program, we will ask for a character from the user and then print its ASCII value using the ord() in-build function.
c = input("Enter a Character: ") print("The ASCII value of character " + c + " is", ord(c))
The ASCII value of character g is 103
The ASCII value of character Y is 89
You can learn about many other Python Programs Here.
Latest posts by Amit Rawat (see all)
- Python Program to Print the Fibonacci Sequence (2 ways) - April 7, 2020
- Python Program to Display or Print Prime Numbers Between a Range or an Interval - June 18, 2019
- Python Program To Print Pascal’s Triangle (2 Ways) - June 17, 2019