I'm struggling to complete the last test, which assesses an entire phrase instead of a single word. Is there a way I can do this without writing a bunch more code? Here's what I have so far:
vowels = ['a','e','i','o','u']
if text[0:2] == 'qu':
return text[2:] + 'qu' + 'ay'
if text[0:2] == "xr" or text[0:2] == "yt":
text += "ay"
return text
if text[0] in vowels:
text += "ay"
return text
if text[0] == 'y':
return text[1:] + 'yay'
if text[0] not in vowels and text[1:3] == 'qu':
text = text[3:] + text[0].lower() + 'quay'
return text
if text[0] not in vowels:
if text[1] == 'y' and len(text) == 2:
text = 'y' + text[0].lower() + 'ay'
return text
con = ''
for x in text:
if x == 'y':
break
if x in vowels:
break
if x not in vowels:
con += x
print(con)
text = text[len(con):] + con + 'ay'
return text```