python - While loop multiple conditions not working -


i tried add condition if while loop meets "y" or "y" still move letters end, keep "y" or "y" @ beginning, yet loop end , add "ay"

print("pig latin translator test!") name = raw_input("what name, friend?") if len(name) > 0 , name.isalpha():     print("hello!") else:     print("that's not name!") word = raw_input("what word?") vowels = ("a", "e", "i", "o", "u", "a", "e", "i", "o", "u") ylist = ("y", "y") if word[0] in vowels:     word = word + "yay" else: 

this section causing problems:

    while word[0] in ylist or (not vowels):         word = word[1:] + word[0]     word = word + "ay" print (word) 

the value of (not vowels) falsy because vowels truthy.

you meant write:

while word[0] in ylist or (word[0] not in vowels): 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -