Mar-22-2021, 11:40 AM
Using a while loop is the right idea. There are many ways to approach this. I personally prefer using a
break
to exit the loop when the stop condition is satisfied.words = [] while True: new_word = input('Enter a word\n') # str() is not needed because input() returns a string by default if new_word.lower() == 'stop': # using lower() makes this comparison work for 'STOP', 'Stop', etc. break words.append(new_word) print(words)