I am trying to create an empty list, eg: week_days. then set up a loop for the user to enter each of the days of the week one at a time by using the append method, (Sunday, Monday, Tuesday, etc……………) and add the days to the list week_days as they are entered by the user.
This is what I have, not sure it’s the right way.
weekdays = []
days = raw_input("Enter week days: ")
weekdays.append(days)
for days in weekdays:
print days
You are only reading in one day and saving that to the list before looping through the list to output it.
You need to build the raw_input and append statements into a second loop where you keep requesting days and appending them to the list until some specific termination condifion is met (eg. not entering anything).
As fegall said, you created a loop to output the results, but you didn’t create a loop to gather the results. Here is an example of what you can do:
entered_data = []
while (1): #create an infinite loop
entered = raw_input("Type stuff ('q' to quit): ")
if entered in ['Q', 'q', 'Quit', 'quit']:
break #break out of the loop
entered_data.append(entered)
for entered in entered_data:
print entered