Answer to Question #245632 in Python for mani

Question #245632

When input is "python learning" output displayed is 16-25-20-8-15-14- 12-5-1-18-14-9-14-7 there is additional - after 14 digit. how to rectify this issue?


1
Expert's answer
2021-10-02T07:24:09-0400
letters = 'abcdefghijklmnopqrstuvwxyz'
print(*['-'.join([str(letters.index(ch) + 1) if ch in letters else ch for ch in word.lower()]) for word in
        input().split()])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS