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
2 odpowiedzi
+ 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 + ", "
+ 1
if letter in vowels:
output += "f" + letter
break