0

It doesn't work :(

Why doesn't the commented part do what I expect? Essentially, every time this code encounters a vowel, it prints said vowel and then "f" + vowel (e.g. "hello" ---> "hefellofo"). I want the code not to print anything after an "i" ONLY IF it is between a "g" or a "c" and a vowel (e.g. "gio", "cia", etc.; the results should then be "giofo", "ciafa", etc.). https://code.sololearn.com/cCH7ONFnrwpr/?ref=app

21st Jun 2019, 9:08 AM
Lorenzo
Lorenzo - avatar
2 ответов
+ 2
I am sure there is still an issue, becuase result is not as expected. If i enter "oops, unexpected result" output is: "oops, unexpected result oo, oo, ps, uu, nee, xpee, ctee, d ree, suu, lt Try this: word = input("") vowels = "aeiou" output = "" for letter in word: #output += letter if letter in vowels: output += letter + ", " print(output) # output: ''' oops, unexpected result o, o, u, e, e, e, e, u, ''' or shorter version: word = input("") vowels = "aeiou" output = "" for letter in word: #output += letter if letter in vowels: print(letter, end=', ') #output += letter + ", "
21st Jun 2019, 9:49 AM
Lothar
Lothar - avatar
+ 1
if letter in vowels: output += "f" + letter break
21st Jun 2019, 9:15 AM
Solo
Solo - avatar