I want to prompt the user for a list of phrases over and over again until they input END
and save all of the user's inputs into a list. How can I do that?
My code so far:
print("Please input passwords one-by-one for validation.")
userPasswords = str(input("Input END after you've entered your last password.", \n))
boolean = True
while not (userPasswords == "END"):
One way to do is with a while loop
:
phraseList = []
phrase = input('Please enter a phrase: ')
while phrase != 'END':
phraseList.append(phrase)
phrase = input('Please enter a phrase: ')
print(phraseList)
Result:
>>> Please enter a phrase: first phrase
>>> Please enter a phrase: another one
>>> Please enter a phrase: one more
>>> Please enter a phrase: END
>>> ['first phrase', 'another one', 'one more']