Initialize 2D list
Initializes a 2D list of given width and height and value.
- Use a list comprehension and
range()
to generateh
rows where each is a list with lengthh
, initialized withval
. - Omit the last argument,
val
, to set the default value toNone
.