2011-10-18 python:list index out of range 2013-06-14 python 中的 IndexError: list ind. 2014-07-18 python 出错,大神们帮忙看下,这个到地上是啥问题呢?. Nov 14, 2017 I'm trying to make a program that can work out a mathematical ratio problem and then take the square root of the answer. To achieve the multiplication part i'm trying to make empty lists to which i add the numbers the user enters to define the ratio, then multiplying the list.
Can anyone stage me to what'beds incorrect?
I obtained stuck on
newGrid.setValue(nk0, nk1, Listk)
attempting to give the values of each times/y of each coord into a various function, which will take three arguments, x con and value. Value is definitely what is usually published in a placement on a grid, a amp; y are usually the coordinates.IndexError: list assignment index out of range
Alex AdamAlex James
2 Solutions
The issue is that ultimately, you appear to become eating in a list index that is definitely either as well little, or as well large.
Based to the error message, the problematic piece of code is definitely
personal.listOfRowsx - 1y - 1 = value
. You contact it by doingnewGrid.setValue(nk0, nk1, Listk)
. The issue can't beListk
, since that's i9000 not really what'beds leading to the stacktrace.Consequently, that indicates either
nk0
ornk1
is certainly too huge fornewGrid.listOfRows
.I would double-check your program code by including in print out claims before that line to analyze those two values, as nicely as double-checking exactly how large your grid is usually.
Since the only place you show up to add any beliefs to
n
is at (I think?):.that implies that the root issue is usually ultimately with the
Listing
variable that you've passed in.Michael0x2aMichael jordan0x2a
what if
a
andy
are usually0
that gives youit doesnt exist
masterzaghmasterzagh