generate functionWed, 08 Feb 2023

The input to the program is a natural number n is the number of rows and columns in the matrix, then the matrix elements (integers) line by line separated by a space.

#Example # n = int(input()) # a = [[int(j) for j in input().split()] for i in range(n)] n = int(input()) a = [] for i in range(n): row = input().split(' ') for j in range(len(row)): row[j] = int(row[j]) a.append(row)

Questions about programming?Chat with your personal AI assistant