• + 0 comments

    Why is the platform not providing the INPUT/OUTPUT format they are looking for? Is the goal to test whether one can multiply a 2x2 matrix, or to test whether one knows how to parse INPUT data from commande line ?

    Be specific!

    if name == 'main': ## Read code fron STDIN n = 2 # Number of rows/columns matrix1 = [list(map(int, input().split())) for _ in range(n)] matrix2 = [list(map(int, input().split())) for _ in range(n)]

    # OR:
    # matrix1 = [[1, 2], [2, 3]]
    # matrix2 = [[4, 5], [7, 8]]
    
    print("A = {0}".format(matrix1[0][0]*matrix2[0][0] + matrix1[0][1]*matrix2[1][0]))
    print("B = {0}".format(matrix1[0][0]*matrix2[0][1] + matrix1[0][1]*matrix2[1][1]))
    print("C = {0}".format(matrix1[1][0]*matrix2[0][0] + matrix1[1][1]*matrix2[1][0]))
    print("D = {0}".format(matrix1[1][0]*matrix2[0][1] + matrix1[1][1]*matrix2[1][1]))