0

Getting Indexerror & can't solve it! n =6 i=0 c=[n] for i in range (n-1): c[i]=int(input("Enter a number:" )) . in Python

It says indexerror list assignment index out of range. Help

13th Sep 2021, 3:17 AM
Farzam Baig
1 Respuesta
+ 2
The list c basically only holds an element and I think it looks like this c = [6] You can either create a list from range() since it returns a list of numbers and comes with a size, or make the list empty and append to it for each iteration
13th Sep 2021, 3:25 AM
Tim
Tim - avatar