0

Then.... x=int(input("Enter number of players")) for i in range(x): players[i]=input() print (players)

why is this bringing an error

24th May 2018, 11:36 AM
Nwankwo Valentine
Nwankwo Valentine - avatar
7 Réponses
+ 4
merely look at your code,its easy to decipher youre trying to iterate over an array/list you haven't even created
24th May 2018, 11:48 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
x=int(input("Enter number of players")) players=[] for i in range(x): players[i]=input() print (players)
24th May 2018, 12:32 PM
᠌᠌Code X
᠌᠌Code X - avatar
0
how
24th May 2018, 12:06 PM
Nwankwo Valentine
Nwankwo Valentine - avatar
0
The players array does not exist according to your code
24th May 2018, 12:13 PM
Zeki Gurbuz
Zeki Gurbuz - avatar
0
Just I want to get the number of players from user and store it in x var Then I want to get players name as list from the user
24th May 2018, 12:21 PM
Nwankwo Valentine
Nwankwo Valentine - avatar
0
where did i made an error according to it pls try elaborate
24th May 2018, 12:22 PM
Nwankwo Valentine
Nwankwo Valentine - avatar
0
then after getting it from the user then print it
24th May 2018, 12:23 PM
Nwankwo Valentine
Nwankwo Valentine - avatar