curriculum/challenges/english/blocks/daily-coding-challenges-python/68ee9e3066cfd4eb2328e8a6.md
Given two integers (a number of rows and a number of columns), return a matrix (an array of arrays) filled with zeros (0) of the given size.
For example, given 2 and 3, return:
[
[0, 0, 0],
[0, 0, 0]
]
build_matrix(2, 3) should return [[0, 0, 0], [0, 0, 0]].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(build_matrix(2, 3), [[0, 0, 0], [0, 0, 0]])`)
}})
build_matrix(3, 2) should return [[0, 0], [0, 0], [0, 0]].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(build_matrix(3, 2), [[0, 0], [0, 0], [0, 0]])`)
}})
build_matrix(4, 3) should return [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(build_matrix(4, 3), [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]])`)
}})
build_matrix(9, 1) should return [[0], [0], [0], [0], [0], [0], [0], [0], [0]].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(build_matrix(9, 1), [[0], [0], [0], [0], [0], [0], [0], [0], [0]])`)
}})
def build_matrix(rows, cols):
return rows
def build_matrix(rows, cols):
return [[0 for _ in range(cols)] for _ in range(rows)]