-1

I am new to python, and I have been having some difficulty as of late. The current prompt that I am working on entails:

Write a program that gets the names of a player's top-five favorite games. Your program should store the names in a list. Then, the program should display teh five game names in the list.

So far this is what I have:

list = [""]
raw_input("\nEnter your top-5 favorite games:")
print "Your favorites are:"
for item in list:
        print item
raw_input("\nPress the enter key to exit")

The problem I am having is that I do not know how to correspond the users input into the list for it to display.

Any thoughts?

Thanks,

Tyler

5
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by JoshuaBurleson
0

You are not appending the list anywhere.

Computer see's list as nothing
See's someone needs to input something
See's something being printed
See's that for every interation it will print a list of nothing
And then see's more user input.

list.append(raw_input("\n Enter you top 5 favorite games: ")
1

You are not appending the list anywhere.

Computer see's list as nothing
See's someone needs to input something
See's something being printed
See's that for every interation it will print a list of nothing
And then see's more user input

and likewise:

>>>r=[]
>>> r.extend((input('Three Things: ').split()))
Three Things: my uncle bob
>>> r
['my', 'uncle', 'bob']
>>>

which could be done without the initial empty list.

Edited by JoshuaBurleson: n/a

This topic has been dead for over six months. 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.