I am trying to input [1]
and enter a new word to append the existing words at list '''words''' in shuffle pattern.
import random
words = ['apple', 'banana', 'orange', 'coconut', 'strawberry', 'lime']
old_word = []
while True:
choice = int(input('Press [1] to continue [2] to exit: '))
if choice == 2:
break
elif choice == 1:
new_word = input('Enter a new word: ')
old_word.append(new_word)
words.append(old_word)
if new_word in words:
random.shuffle(words)
print(words)
e.g
input 1
Enter a new word: lemon
output 'orange', 'banana', 'lime', 'apple', 'lemon','coconut', 'strawberry'