Python - Ways to Flatten a 2D list
We are given a 2D list we need to flatten that given list. For example, a = [[1, 2, 3], [4, 5], [6, 7, 8]] we need to flatten it so that the output becomes [1, 2, 3, 4, 5, 6, 7, 8].Using a Nested LoopA nested loop iterates over each sublist in the 2D list and then over each element in the sublist ap