Python

Python Program to Find ASCII Value of Character1 min read

Write a program to Find ASCII Value of Character in Python

Code:




This Python program takes a single character as input from the user and uses the built-in ord() function to find the corresponding ASCII value of the character.

The program prompts the user to enter a character and assigns it to the variable c. Then, it calls the ord() function, passing in the character as an argument. The ord() function returns an integer representing the ASCII value of the character.

Finally, the program prints out a string, concatenating the character and the ASCII value of that character using string formatting.

For example, if the user enters the character 'A', the output would be:

Leave a Comment