It doesn't work :( | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

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

24th Jun 2019, 8:55 AM
Lorenzo
Lorenzo - avatar
2 Réponses
+ 1
(str(word.index(letter) + 1) doesn't work very well because it does not return a letter, instead it returns the index number (Example Output: "2"). You should replace str(index) with word[index] this returns the character of the index number
24th Jun 2019, 10:06 AM
CodeMStr
CodeMStr - avatar
24th Jun 2019, 10:11 AM
CodeMStr
CodeMStr - avatar