15 lines
No EOL
354 B
Python
15 lines
No EOL
354 B
Python
|
|
import string
|
|
message = '''
|
|
This program prints the Ascii codes for all the letters
|
|
in a text string entered by the user.
|
|
'''
|
|
|
|
print(message)
|
|
|
|
stringOfLetters = input("Enter a name or phrase: ")
|
|
|
|
# Note: The ord() function returns the integer code for a character.
|
|
|
|
for myCharacter in stringOfLetters:
|
|
print(f"{myCharacter:2s}{ord(myCharacter):3d}") |