a = input("Enter a character: ") print("The ASCII value of '" + a + "' is",ord(a))
Enter a character: A The ASCII value of 'A' is 65
Here we have used ord()
function to convert a character to an integer (ASCII value). This function actually returns the Unicode code point of that character.