Initialize list with values
Initializes and fills a list with the specified value.
- Use a list comprehension and
range()
to generate a list of length equal ton
, filled with the desired values. - Omit
val
to use the default value of0
.
Initializes and fills a list with the specified value.
range()
to generate a list of length equal to n
, filled with the desired values.val
to use the default value of 0
.