Python Program for Character to ASCII Conversion

Character to Ascii conversion

Python program to convert a given character to its corresponding ASCII value has been shown here. The algorithm, time complexity and pseudocode of the program can be found here. Find here the flowchart of the problem.






1. Python Program & output for Character to ASCII Conversion

Code has been copied
# ***********************************************
#               Alphabetacoder.com
# Python proram for character to ASCII conversion
# ***********************************************

# take input of the character
x = input("Enter the character = ")
# convert and store ASCII value of the character
# ord() function is used to convert character to ASCII
v = ord(x)
print("ASCII value of ", x, " is = ", v)

Output


Case 1:

Enter the character = s

ASCII value of s is = 115


Case 2:

Enter the character = C

ASCII value of C is = 67