- #1
azerty12
- 15
- 0
Hi all!
I'm learning programming on Python.
Currently, I'm trying to implement a recursive algorithm using a divide and conquer method to compute a product of matrices.
Yet an error occurs when I try to assign an element in a list (representing a matrix)
I can't understand where the problem comes from, since I tried on the shell to enter a matrix exactly as in the program and assign its values (C[0][0]=...) and it works.
But when I try to execute the program, the following error is raised:line 42, in sqmat_mult_rec
C[0][0]=A[0][0]*B[0][0]
TypeError: 'int' object is not subscriptable
Any idea?
(code attached)
I'm learning programming on Python.
Currently, I'm trying to implement a recursive algorithm using a divide and conquer method to compute a product of matrices.
Yet an error occurs when I try to assign an element in a list (representing a matrix)
I can't understand where the problem comes from, since I tried on the shell to enter a matrix exactly as in the program and assign its values (C[0][0]=...) and it works.
But when I try to execute the program, the following error is raised:line 42, in sqmat_mult_rec
C[0][0]=A[0][0]*B[0][0]
TypeError: 'int' object is not subscriptable
Any idea?
(code attached)
Attachments
Last edited: