Question

Write a program to multiply two matrices using array.

07 Aug 2023
Answer :
Word Count : 601

Here's a Python program that multiplies two matrices using arrays (lists of lists):

def matrix_multiplication(matrix1, matrix2):
    rows1 = len(matrix1)
    cols1 = len(matrix1[0])
    rows2 = len(matrix2)
    cols2 = len(matrix2[0])

    if cols1 != rows2:
        print("Matrix multiplication not possible.")
        return None

    result = [[0 for _ in range(cols2)] for _ in range(rows1)]

    for i in range(rows1):
        for j in range(cols2):
            for k in range(cols1):
                result[i][j] += matrix1[i][k] * matrix2[k][j]

    return result

# ________ _________ _______ __________ ___ _____.
_____ ______ _____ ___ ___ ____ ______ ______ __________.
_________ _____ __________ _____ _________ _______ ___ __________ _____ ________ ________.
_______ ______ _________ ________ __________ ______ _______ ____ ___ ________.
__________ _____ ________ __________ _______.
______ __________ ______ ___ ____.
____ _____ ______ _____ __________ _____ ___ ______ _____ ______ _________ __________.
____ ________ _______ ________ ____ ___ _______ ______ _______ ___ ______ ________.
________ _________ _______ ___ ________.
__________ ______ _____ ___ _____ ___ __________ __________ _________.
________ __________ ____ _________ ___ ______ ______ _________ ___.
___ _________ ____ _________ ____ __________ __________ _______ ________.
________ _______ ______ ___ ___.
_______ ________ ________ _________ __________ ___ _________ _________ _______ _______ _________.
__________ _________ ____ ____ _________ _____ _________ __________ _______.
___ _____ ____ ____ _________ ___ ______ ______ ___ ____.
________ ___ ___ ____ ___ ______ _______ ____ ______ ______ ______ _________.
____ ___ _________ _____ __________ ____ __________ __________.
________ _____ __________ _________ _______ _________ ___.
_______ _____ _________ ___ ___ ___ _________ ___ ____ _________ __________.
____ ______ _____ ________ _______ ________ ______ ___.
________ ______ _______ _________ __________.
________ __________ ____ ___ _______ _____ _____ ______ ___ ____ __________ _________.
________ __________ ________ _____ _____.
________ ______ ______ __________ _______ _________.
_______ __________ ____ _____ ________ ________ __________ _______ _____.
_______ ______ _________ ______ _______ ______ ________ ___ __________ ____.
________ __________ ____ _____ _____ ____ __________ _________ ________.
_________ ________ ___ ______ __________ _______ ______.
_______ _____ ____ ________ _____ __________ ____ _______ _________ _________ _________ ____.
_______ _______ __________ _____ _______ _____ ____ ___ ______ ________ ________.
_______ ________ _____ _______ _____ _____ ____ ______ ________ __________ ________ ____.
______ __________ ____ ________ ________ ______ ________.
_________ _______ ________ ______ ________ ___ _________ _________ _____ __________.
______ ______ ________ ____ ____ _____ _____ ____ _________ ________ __________.
__________ ___ ___ _______ ___ _________ __________ _______ _________.
____ ________ _________ ______ ________ _____ ________.
_____ ______ _________ ________ __________ ______ ___ ___ __________.
_______ _______ ________ ______ __________ _________ ____ ________ ________ ______ _____.
_________ _________ _________ ____ ________ ___ ____ _________ _________.
______ __________ ____ ______ __________ _______ _________ _____ _________ ____.
__________ _______ ________ ____ _______ _______ ___ ______ ____ __________ _____.
____ _________ _____ ______ ______ ___.
_______ _____ _______ ___ ________ ________ _________ ______ ________ _____ ______ __________.
________ _________ _____ _________ _______ ____ ________ __________ ______ ___ __________ ___.
____ _____ ____ _____ ______ _____.
________ _____ _____ _________ _________ __________.
___ ____ ____ ____ ____.
__________ _____ ______ ______ __________ ___ _________ _______ ____ _______ ______ ______.
______ ______ _________ ___ _______ _____ _____ ________.
_______ __________ _______ _________ ___ _____.
_______ _______ ______ ________ ______ _____ ______ ________ ________ _____ _________.
_____ ______ _________ ___ _______ __________ ______ _____.
___ _______ _____ ____ ______ __________.
_________ ________ ________ ____ ____ _____ ________ ____.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Write a program to multiply two matrices using array.
🟢
WhatsApp Chat Fast live messaging
Email Us Business enquiries & support