Hii im having trouble solving the pig latin exercise. For some reason it isn’t working for the full sentence. it passed the test on everything else. But it doenst translate “quick” to “ickquay”. It results to plain “ick”. Im not sure why. Even chatGPT said its ok and it should be working, but its not.
def translate(text):
vogais = (“a”, “e”, “i”, “o”, “u”)
if text[0] in vogais or text[:2] in (“yt”, “xr”):
return text + “ay”
elif text[:2] == “qu”:
return text[2:] + text[:2] + “ay”
elif “qu” in text[:3]:
return text[3:] + text[:3] + “ay”
elif “y” in text[1:3]:
indexy = text.find(“y”)
return text[indexy:] + text[:indexy] + “ay”
else:
fv_index = next((i for i, char in enumerate(text) if char in vogais), None)
return text[fv_index:] + text[:fv_index] + “ay”