Hi, first off all, thank you for making this website, you’re amazing, but i think there is and issue with the “pig latin” exercise in python where my interpreter gave a different answer than the tester with this code:
PS: yes the code is awful, it’s a draft, that’s not what matters.
VOWELS = {"a", "e", "i", "o","u","A", "E", "I", "O", "U"}
def translate(text):
consontant = ""
if text[:2] == "xr" or text[:2] == "yt":
return text + "ay"
for letter in text:
if is_consonant(letter):
if letter != "y":
VOWELS.add("y")
if text[:2] == "qu":
consontant += text[:2]
text = text.replace(text[:2],"",1)
break
else:
consontant += letter
text = text.replace(text[0],"",1)
else:
break
return str(text + consontant + "ay")
def is_consonant(letter):
return not any (i in VOWELS for i in letter)
print(translate("yellow"))
here, the print (and ourselves if we look into it) says that the final print will be “ellowyay”, but pytest will tell you that it gives “yelloway”
obligatory “english is not my first language”