[Tutor] matx3.py
dn
PythonList at DancesWithMice.info
Wed Dec 27 17:45:17 EST 2023
On 28/12/23 11:34, Ethan Rosenberg wrote:
> Tutor -
>
> Thank you for the wonderful help you provide to Python programmers.
>
> Here is the program
>
> #matx3.py
> #Put i*j in cells of 3x3 matrix
>
> Row = 1
> Column =1
> mat = [[1],[2],[3]],[[4],[5],[6]],[[7],[8],[9]]
> #print(mat)
> for i in range(0,3):
> print(mat[i])
> for i in range(0,2):
> for j in range(0,2):
> for k in range(0,8):
> mat[k] = i*j
> #print(mat)
> for i in range(0,3):
> print(mat[i])
>
> I receive an error that mat[k] = i*j is a tuple??
>
> Thanks in advance for your help.
Please copy-paste the full set of error-messages rather than your
summary/interpretation.
mat is indeed first defined as a tuple.
What did you intend it to be?
--
Regards,
=dn
More information about the Tutor
mailing list