Question:
Write a python program to find ASCII character of a variable
Program:
1 2 3 |
c = input("Enter a character: ") print("The ASCII value of '" + c + "' is",ord(c)) |
Explanation:
ASCII (American Standard Code for Information Interchange) is the most common format for text files in computers and on the Internet. In an ASCII file, each alphabetic, numeric, or special character is represented with a 7-bit binary number (a string of seven 0s or 1s). 128 possible characters are defined.
Output:
1 2 |
Enter a character: H ("The ASCII value of 'H' is", 72) |
Leave a Reply