No installations needed! Write Python directly in your browser and get instant feedback with our smart validation system.
Flatten a list that contains elements and one-level nested lists into a single list.
You are given a list called
The list may contain individual elements and sublists (1 level deep).
Flatten the list so that all values appear in a single list.
Print the flattened list.
Output:
Get your code reviewed and validated to understand what you did right and where you can improve.