Table of Contents
Introduction
ASCII stands for American Standard Code for Information Interchange. It is a standard which allocate numbers, alphabets and special characters in 8-bit code. In python we have pre-defined function ord() which directly converts the input to its ASCII value.
Program
value = input("Enter the character: ") output = ord(value) print("The ASCII value of {0} is {1}".format(value, output))
Output:
Explanation
In the above python code, we have created a variable value to store the user input. The ord() function is pre-defined python function which converts the strings to its ASCII value. The ASCII value is stored in variable output and is displayed using print() function.
0 Comments