Flatten it out #
Write a function that takes a list as input and returns a new list with all the values flattened. The input list can contain non-list values, lists, or even nested lists. The goal is to create a single-level list containing all the values from the input list.
Tests #
flatten_list([5, 6, 7, 8])should return[5, 6, 7, 8]flatten_list([[1], [2], [3], [4]])should return[1, 2, 3, 4]flatten_list([1, [2, 3], [4, [5, 6]]])should return[1, 2, 3, 4, 5, 6]flatten_list([7, [8, 9, [10]], 11])should return[7, 8, 9, 10, 11]flatten_list(['a', ['b', ['c', 'd']]])should return['a', 'b', 'c', 'd']
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules