Answers for "initialise a matrix in python"

1

python initialize matrix

# Declaring rows
N = 5
  
# Declaring columns
M = 4
  
# using list comprehension 
# to initializing matrix
res = [ [ 0 for i in range(M) ] for j in range(N) ]
Posted by: Guest on June-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language