Python Program to print ASCII Value of a character

Python Program to print ASCII Value of a character

In this tutorial, we will learn how to print the ASCII value of a character

Explanation ✏

  1. First, We need to take input from the user
  2. Now with the help of the ord() function, we will find the ASCII value of the input value
  3. Finally, print the output

Code 👩‍💻

def covASCII():
    inputChar = input("Enter a character: ")
    ordChar = ord(inputChar)
    print(ordChar)
covASCII()

Output :

Enter a character: A

The ASCII value of A is 65