ASCII Conversion

#!/usr/bin/evn python

# Take character as input from the user
char = input("Enter a character: ")

# ord() function covert character to relevant ASCII value
print("The ASCII value of '" + char + "' is",ord(char))

# Take input from the user and convert into integer
asci = int(input("Enter a ASCII value (int): "))

# chr() function use to convert integer (ASCII) to relevant character
print("The ASCII value of '",asci,"' is",chr(asci))


#***** Output *****
Enter a character: b
The ASCII value of 'b' is 98
Enter a ASCII value (int): 100
The ASCII value of '100' is d

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!