2

My function is:

vowels=('a','e','i','o','u')
prefixes=('bl','br','ch','cl','cr','dr','fl','fr','gl','gr','kl','ph','pl','sh','sl','sp','sr','st','th','tr','wh','wr')
def convertToPigLatin(word):
    first_prefix=word[0:2]
    first_letter=word[0]
    if first_prefix in prefixes:
        return word[2:]+word[0:2]+'ay'
    if first_letter in vowels:
        return word+'yay'
    else:
        return word[1:]+word[0]+'ay'

now what would I enter and where at to make it loop and break if the user enters nothing

Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
  • Possible duplicate of [Asking the user for input until they give a valid response](https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response) — although it sounds like the inverse of it. – martineau Mar 02 '19 at 01:32

1 Answers1

1

Im not really sure what you meant, but what I understood is that you want this function to be repeatedly asked until somebody inputs nothing. Here is my answer(please correct me if i am wrong):

while True:
   x = input("convert to piglatin")
   if x == "":
       break

   print(convertToPigLatin(x))

If this isn't what you wanted please describe a little bit better in the comments. Thanks!

Abhiraam Eranti
  • 350
  • 5
  • 19