0

why is it saying index out of range?

https://code.sololearn.com/cuZm73ygOMz8/#py i am trying to input a list of integers , find their divisors and judge if their sufficient.

13th May 2018, 7:23 PM
Tanvir Hasan
Tanvir Hasan - avatar
5 Respostas
+ 3
Your data must be entered like 560 making a lst of [5, 6, 0], which doesn't crash.
13th May 2018, 8:10 PM
John Wells
John Wells - avatar
+ 2
We need to know what input you are giving as that might be the problem.
13th May 2018, 7:50 PM
John Wells
John Wells - avatar
0
for example if your array contains only 5 elements . when you try to access for example array [7] you will get index out of range .
13th May 2018, 7:55 PM
zakaria kasmi
zakaria kasmi - avatar
0
how do i use a list comprehension to take in numbers of two or more digits?
13th May 2018, 9:37 PM
Tanvir Hasan
Tanvir Hasan - avatar
0
lst=[int(x) for x in input().split()] will allow space between numbers so 15 65 340 0 will work all on one line.
13th May 2018, 11:28 PM
John Wells
John Wells - avatar