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?
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()])
Comments
Leave a comment