A Program to Find ASCII Value of Character

In this example, we are giving a program to find ASCII value of character.


Program to find ASCII value of character:

  1. # Convert decimal to find ASCII value of character
  2. char = input('Enter a value: ')
  3. print("The ASCII value of " + char + " is ", ord(char))

Output:

Enter a value: D
The ASCII value of D is  68