Question: In Python: 7. Write a function flatten that returns a simple list containing all the values in a nested list: test(flatten([2,9,[2,1,13,2],8,[2,6]]) == [2,9,2,1,13,2,8,2,6]) test(flatten([[9,[7,1,13,2],8],[7,6]]) ==
In Python: 7. Write a function flatten that returns a simple list containing all the values in a nested list: test(flatten([2,9,[2,1,13,2],8,[2,6]]) == [2,9,2,1,13,2,8,2,6]) test(flatten([[9,[7,1,13,2],8],[7,6]]) == [9,7,1,13,2,8,7,6]) test(flatten([[9,[7,1,13,2],8],[2,6]]) == [9,7,1,13,2,8,2,6]) test(flatten([["this",["a",["thing"],"a"],"is"],["a","easy"]]) == ["this","a","thing","a","is","a","easy"]) test(flatten([]) == [])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
