In the last problem, we get an error if we enter more than one character at a time. Rewrite the program so that it only calls the ord method if a single character is entered.
Sample Run
Enter a character: *
ASCII #42
Enter a character: exit
Not a character
1
Expert's answer
2019-10-23T07:43:41-0400
char = input('Enter a character:')
if len(char) != 1:
print('Not a character')
else:
print('ASCII #{}'.format(ord(char)))
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment