Flatten the list
Input: [1,2,[3,[4,5,6],[7,8,9]],10,11] Output: [1,2,3,4,5,6,7,8,9,10,11] I have no idea how to do this. Can somebody help?
Recursion would be useful for that problem.
You can check whether an item is a list by isinstance method: isinstance(item, list) This means that item belongs to the list class.
This might help https://code.sololearn.com/c5iOBsdgp3Zi/?ref=app
another way https://code.sololearn.com/ccCOxaXww84i/?ref=app
This seems to work too: https://code.sololearn.com/cgr2lBqxQ2BA/?ref=app