0

python logical error

It looks there are some logical errors in my code. How should I change my code in the case a word starts with a vowel and is capitalized or has punctuation? Also, I want you to help to write code how to concatenate a " " between words(main). Thank you in advance. Here is my code. https://code.sololearn.com/c9DuvrSt72xH

8th Mar 2022, 6:42 AM
rappy
1 Answer
0
# this is my little version: a = input().split() b = ''.join(list(map(chr,range(97,123)))+list(map(chr,range(65,91)))) res = [] for i in a: punc = i[-1] if i[-1] in '?!.' and len(i)!=1 else '' if i[0] not in b: res.append(i) else: if i[0] in 'aeiouy': res.append(i[1:-1]+i[0]+'way'+punc) else: res.append(i[1:-1]+i[0]+'ay'+punc) print('Translated: %s'%(' '.join(res)))
8th Mar 2022, 7:35 AM
Ervis Meta
Ervis Meta - avatar