days = ["sunday","monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] answered = False while answered == False: userInput = input("What day of the week would you like to assign a event: ") lst = [] input_words=userInput.lower().split() for word in input_words: if word in days: lst.append(word) print(word) # set answered to True boolean answered = True print((lst)) #only evaulated after reviewing all words, if True is not set, prompts user again and let's them know that their answer is not valid also idk why above is not showing as a comment :( if answered == False: print("You typed days of week wrong! Try Again!") def listToString(lst): if 0 < 2: test = open('list.txt', 'w') print(test.write(lst)) test.close()
listToString
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)