Reputation: 11
I'm new to python and I made this code to get a number from the user. Im not sure how but i want to make input boxes equal equal to the number placed in the first line of code.
code
x = input("How many video games do you own: ")
list1 =[x]
for games in list1:
name1=input("Enter game1: ")
What i want to happen
How many video games do you own: 4
Video game 1 = 1
Video game 2 = 2
Video game 3 = 3
video Game 4 = 5
[1,2,3,4]
no errors, just prints game1
How can i make this happen?
Upvotes: 0
Views: 103
Reputation: 27
is
x = input("How many video games do you own: ")
list1 = []
for games in range(int(x)):
name1 = input("Enter game1: ")
list1.append(name1)
print(list1)
Upvotes: 1