0
Please help, why is this not working?
def Piglatin(word): word = word.split(" ") vowels="aeiou" for elements in word: if elements[0] not in vowels: element=elements.replace(elements[0],"") element=element+ elements[0]+"ay" return element else: element= elements + "ay" return element Piglatin()
2 Answers
+ 1
For starters:
1. you haven't provided the argument for the Piglatin() method
2. No need to .split() the word, you can iterate through it as a string, too
3. When iterating, check another element each time, not the same one (elements[0])
4. Return the element value once, after the whole iteration is done - otherwise it will return the first character and will exit the Piglatin() method
0
Thank you sir