I'm a begginer and having trouble adding matrices with python. Can someone help (my code is not working and I don't know why). See below:

def main(lines, colunes, value): matrice=[] for i in range(lines): line=[] for j in range(colunes): line.append(value) matrice.append(line) return matrice def soma_matrices(A,B ): num_lin = len(A) num_col = len(A[0]) C = matrice.cria_matrice(num_lin, num_col, 0) for lin in range(num_lin): for col in range(num_col): C[lin][col] = A[lin][col] + B[lin][col] return C if __name__ == '__main__': A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[100, 200, 300], [400, 500, 600], [700, 800, 900]] print(soma_matrices(A,B )) main()

This post has been edited by **modi123_1**: 25 September 2019 - 11:56 AM

Reason for edit:: the future, please use the [code] tag button in the editor.