Print ASCII Value in Python

In this post we will learn how to print ASCII value in python using simple python program.

What is ASCII value/code?

ASCII stands for American Standard Code for Information Interchange.

As we know that computer does not understand human language and it stores data in the form of 0 and 1. Therefore ASCII value is used to convert the characters and symbols into numeric value and then this numeric value is further easily converted in to 0, 1 format.

All the characters and symbols present in the computer are assigned numeric values from 0-255.

Program to Print ASCII Value in Python

Below program is about how to print ASCII value in Python using ord() Method.

#Python program to find the ASCII value of characters

c = input("Enter the character\n")
v = ord(c)
print("The ASCII value of "+ c +" is", v )

Output:

Enter the character
b
The ASCII value of b is 98
What is ord() Method?

ord() method is an in-built function in python which is used to convert a character into its Unicode value.

Leave a Reply