Question #96

What is the output of the following code snippet?
l = [[1, 2, 3], [4, 5, 6], [7], [8, 9]]
[item for sublist in l for item in sublist]

[item for sublist in l for item in sublist] is a list comprehension. It iterates over every element in the sublists of l and creates a new flat list with them. (stackoverflow.com/questions/952914/how-to-make-a-flat-lis...)


Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵


Similar questions: