avatar Bite 296. Jagged list

Write a function that takes an irregular shaped list of lists and makes it symmetrical by adding a fillvalue to each sublist:

Example:  

>>> jagged_list([[1, 1, 1, 1], [0, 0, 0, 0], [1]], fillvalue=1)
[[1, 1, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1]]

Hint: Some functions in the itertools module may be useful.

 

Login and get coding
go back Intermediate level
Bitecoin 3X

38 out of 38 users completed this Bite.
Will you be Pythonista #39 to crack this Bite?
Resolution time: ~21 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 2.67 on a 1-10 difficulty scale.
» You can do it! 😌

We use Python 3.8