YouTip LogoYouTip

Python3 Ascii Character

# Python3.x Python ASCII Code and Character Conversion [![Image 3: Document Object Reference](#) Python3 Examples](#) The following code implements the conversion between ASCII codes and characters: ## Example (Python 3.0+) # Filename : test.py# author by : www..com# User inputs a character c = input("Please enter a character: ")# User inputs an ASCII code and converts the input number to an integer a = int(input("Please enter an ASCII code: "))print("The ASCII code of", c, "is", ord(c))print("The character corresponding to", a, "is", chr(a)) Executing the above code produces the following output: python3 test.py Please enter a character: a Please enter an ASCII code: 101 The ASCII code of a is 97101 The character corresponding to 101 is e [![Image 4: Document Object Reference](#) Python3 Examples](#)
← Python3 Odd EvenPython3 If Example β†’