Let's say we have an existing empty list, m. I would like to append some elements (let's say three 7's) to m so that m is now [7,7,7]. How to do this using list iterators?
I have the following solution, which is not complete:
m = []
m.append([7 for i in range(3)])
I get m = [[7,7,7]] but not [7,7,7].
I am not looking for post-processing like making m flat such as:
flat_list = [item for sublist in l for item in sublist], because it is an extra step.