im asking w input() for user to input "spelling words" for a kids homework, and i want it to append or add the words entered into a list. i got it to ask for user input for the words, but not sure how to make it add them into a list. any ides?? thanx in advance :)

8 Years
Discussion Span
Last Post by fuston05

ok, heres what i have so far. now it will append the input to a list but it doesnt seem to remember the last thing you enter 'cause it will print the list showing only what word you just entered instaed of showing a growing (appended) list. weird. i need it to save all the words i enter and add the new ones when i enter them as well. heres the code so far:

from __future__ import print_function

more_words = "y"
while more_words == "y":
   spell = []
   a = raw_input("Please enter all you spelling words? ")

spell = []
defines an empty list on every pass through the loop. You want it before the while(). Also, your code is an infinite loop, i.e. there is no exit.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.