game-of-life icon indicating copy to clipboard operation
game-of-life copied to clipboard

Why am i getting a type error?

Open NET-OF-BEING opened this issue 6 years ago • 1 comments

Im using python 3.6.5 and receiving the following Error.

Traceback (most recent call last): File "conway.py", line 40, in A = conway(A) File "conway.py", line 16, in conway k[m/2-1 : m/2+2, n/2-1 : n/2+2] = np.array([[1,1,1],[1,0,1],[1,1,1]]) TypeError: slice indices must be integers or None or have an index method

NET-OF-BEING avatar Jun 21 '18 17:06 NET-OF-BEING

Im using python 3.6.5 and receiving the following Error.

Traceback (most recent call last): File "conway.py", line 40, in A = conway(A) File "conway.py", line 16, in conway k[m/2-1 : m/2+2, n/2-1 : n/2+2] = np.array([[1,1,1],[1,0,1],[1,1,1]]) TypeError: slice indices must be integers or None or have an index method

Since slice indices should be integers here, changing '/' to '//' here will fix the issue. k[m//2-1 : m//2+2, n//2-1 : n//2+2] = np.array([[1,1,1],[1,0,1],[1,1,1]])

wsyxbcl avatar Mar 27 '19 05:03 wsyxbcl