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 :)

Recommended Answers

All 3 Replies

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:

#!/usr/ben/python
#SpellingWordPractice
from __future__ import print_function

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

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.

awesome, tyvm :) much appreciated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.