Puzzle 15 - Non-Recursive List Unpacking(with duplicates)

SAS
0
Flatten a Nested List in Python Without Recursion

You’ve been given a jumbled guest list where names are stored in a nested structure of lists within lists. Some guests appear more than once — that’s okay. Your goal is to unpack this structure into a flat list with out using the recurssion and keeping all duplicates . This solution should work with any level of nesting.


Input & Expected Output

Input List

Guests = ["John Doe","Jane Doe",["Emily Doe","John Doe","Michael Smith"],["sarah Johnson",["Michael Smith","David Brown","Alice Green"],"Bob White","Alice Green"]]

Try solving the question yourself! If you need help, click below to reveal the solution.





Post a Comment

0Comments

Post a Comment (0)