Question

In Python, in a loop - Thas ASCIICodesStringtoString can be any length divided by 3. Write...

In Python, in a loop - Thas ASCIICodesStringtoString can be any length divided by 3.

Write a function called ASCIICodesStringToString that will accept a string of 3 digit codes which represent ASCII values (all padded to three digits with leading 0's when needed).   The function should return the string equivalent assuming each 3 digit code can be converted to an ASCII value and from there into a letter. For instance:

>>> ASCIICodesStringToString("066065068")

'BAD'

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def ASCIICodesStringToString(s):
    result = ''
    for i in range(0, len(s), 3):
        d = s[i:i + 3]
        result += chr(int(d))
    return result


print(ASCIICodesStringToString("066065068"))

Add a comment
Know the answer?
Add Answer to:
In Python, in a loop - Thas ASCIICodesStringtoString can be any length divided by 3. Write...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT