n = 5 L = 6 Cache = [[-1 for x in range(n+1)] for y in range(L+1)] print(Cache)
The above code gives the below error.
Traceback (most recent call last): File "/Users/globetrekker/Documents/CS5050/Assignment3/temp.py", line11, in <module> print(Cache) IndexError: list index out of range
I am new to Python. So I don't understand how to rectify this error as I don't understand why can't I index into Cache
Have an answer?