Create a Matrix in Python || While Loop || Python
In this we are going to see a basic program on how to create a 3x3 matrix with while loop in Python Programming Language.


def create_matrix():
    row = 3
    col = 3
    matrix = []
    i = 0
    while i < row:
        matrix.append([])
        j = 0
        while j < col:
            matrix[i].append(i*j)
            j += 1
        i += 1
    print(matrix)

create_matrix()

# Coded By Dhiraj Shelke

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post