Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
How would one write a code to display the conversion of individual letters in a string to it's ASCII equivalent? One example of the output in shell would look like this:
Enter a 3-letter word: Hey H = 72 e = 101 y = 121
ord
chr
Use built-in ord function
>>> ord('H') 72
Add a comment
Get the input, and print each character plus its ordinal value.
user_input = input("Enter a 3-letter word: ") for character in user_input: print(character + " = " + ord(character))
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
ordto get ascii equivalent of the character. Andchrto convert ascii value to character.