Wednesday, April 24, 2024

📑 Unpacking Nested Lists

📑 Task

1) What result will be printed?
2) Write a function that extracts all elements of lists and tuples into one list without nesting
Try it for this difficult case list_ = [[1, 2], (3, ), [[[(4, 5)]]], 6, 7]

📑 Answer

1) [1, 3, 5, 2, 4, 6] [[1, 3, 5], [2, 4, 6]]
2)

No comments:

Post a Comment