Nested lists are lists made up of other lists. In some cases we would like to transform these “lists of lists” into a singular list. This is called “flattening” a list. Write a python script that flattens lists.
Dodona will automatically provide input lists for your script. However since Dodona is quite particular when it comes to input and evaluation of python scripts you should start your script with:
Nested_list = eval(input())
You can then write your python code for flattening the list called Nested_list. At the end of your script, print out the new flattened list.
Input:
[[1,2,3], [4,5]]
Output:
[1, 2, 3, 4, 5]