Python Program To Find ASCII Value Of A Character
Maybe your like
In this tutorial, we will see how to find the ASCII value of a character. To find the ASCII value of a character, we can use the ord() function, which is a built-in function in Python that accepts a char (string of length 1) as argument and returns the unicode code point for that character. Since the first 128 unicode code points are same as ASCII value, we can use this function to find the ASCII value of any character.
Program to find the ASCII value of a character
In the following program, user enters the character and the program returns the ASCII value of input character.
# Program to find the ASCII value of a character ch = input("Enter any character: ") print("The ASCII value of char " + ch + " is: ",ord(ch))Output: 
Program to find the character from a given ASCII value
We can also find the character from a given ASCII value using chr() function. This function accepts the ASCII value and returns the character for the given ASCII value.
# Program to find the character from an input ASCII value # getting ASCII value from user num = int(input("Enter ASCII value: ")) print(chr(num)) # ASCII value is given num2 = 70 print(chr(num2))Output: 
Related Python Examples
1. Python program to find sum of n natural numbers 2. Python program to add digits of a number 3. Python program to convert decimal to hexadecimal 4. Python program to print calendar
Top Related Articles:
- Python Program to Print Calendar
- Python Program to Check if a Number is Positive Negative or Zero
- Python Program to Convert Celsius To Fahrenheit and Vice Versa
- Python Program to Convert Decimal to Hexadecimal
- Python Program to Find Largest among Three Numbers
Tag » Code Ascii Characters Python
-
Python Program To Find ASCII Value Of Character - Toppr
-
Python Program To Find ASCII Value Of Character - Programiz
-
How To Get The ASCII Value Of A Character - Python - Stack Overflow
-
Python Ascii() Method (With Examples) - TutorialsTeacher
-
ASCII Value Of Letter In Python - W3resource
-
Handling ASCII Character In Python | By Uniqtech | Interview Buddy
-
ASCII Chart - Python Reference (The Right Way) - Read The Docs
-
Python Programming/Strings - Wikibooks, Open Books For An Open ...
-
Ascii() In Python - GeeksforGeeks
-
Python Ascii() Function - W3Schools
-
Unicode & Character Encodings In Python: A Painless Guide
-
Program To Print ASCII Value Of A Character - GeeksforGeeks
-
How To Check If A String Contains All ASCII Characters In Python
-
What Is The Ascii() Function In Python?