[Tutor] matx3.py

Ethan Rosenberg ethanrosenberg414 at gmail.com
Wed Dec 27 17:34:30 EST 2023


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.

Ethan Rosenberg


More information about the Tutor mailing list