Nov-18-2018, 04:15 PM
(This post was last modified: Nov-18-2018, 04:16 PM by pythonlearnery.)
Write a function called userWords() that repeatedly asks the user to enter words until they enter the word "stop!". Every word the user enters should be stored in a nested list arranged by word-length such that all the 3-letter words are stored in a list at index 3 (for example). Return the nested list when complete. You may assume no word is larger than 9 letters.
This is what I have so far, but it will not work.
This is what I have so far, but it will not work.
def userWords(): words = [] while True: word = str(input("Enter a word: ")) if word == "stop!": break else: words.append(word) print(words) userWords()Thanks