Developer education platform

Learn to Code with Hands-On Exercises

Practello is an education platform for developers of all levels. Practice with 50,257+ coding exercises across 20 topics — each one includes a clear explanation, starter code, hints, and a full solution. Pick a topic and start solving.

Flatten a Nested List

Python Fundamentals · python · intermediate

Exercise
Python lists can contain other lists, creating nested structures. A common task is to "flatten" these into a single list of values. Recursion is the natural approach: for each element, if it is a list, recurse into it; otherwise, append it to the result. Python's isinstance() function checks whether an element is a list.
1 / 4
50,257+
Exercises
20
Topics
3
Difficulty Levels
Free
Sample Exercises

Built for developers at every level

Whether you are writing your first function or exploring a new language, there are exercises for you.

Beginners

Start from scratch with beginner exercises that teach one concept at a time.

Self-taught developers

Fill knowledge gaps with structured exercises across topics you missed.

Senior developers

Explore new languages, frameworks, and advanced patterns through practice.

Interview candidates

Sharpen algorithms, data structures, and system design skills.

How it works

Three simple steps to start learning.

1

Pick a Topic

Choose a programming language, framework, or subject — frontend, backend, databases, algorithms, or another track from our catalog.

2

Solve the Exercise

Read the explanation, start from the provided code, use hints when you get stuck, and compare your answer with the reference solution.

3

Track Your Progress

Bookmark exercises, monitor your completion rate, and explore related exercises. Subscribe to Pro for full features or buy exercise bundles for permanent access.

Everything you need to learn by doing

Each exercise comes with everything you need to understand the concept, write the code, and check your solution.

Large Exercise Library

Browse exercises by topic, difficulty, and tags. Each item is a self-contained lesson with explanation, starter code, and a vetted solution.

20+ Topics

Follow curated curricula across frontend, backend, data, DevOps, security, and more — layer by layer, from fundamentals to advanced topics.

Progress & Bookmarks

Track completion, save exercises to collections, and pick up where you left off. Pro unlocks full progress history across every topic.

Explanations & Solutions

Every exercise includes teaching text and a reference implementation. Free accounts see full solutions on sample exercises; Pro extends access per your subscription.

Multiple Languages

Practice in the languages that match your stack — JavaScript, TypeScript, Python, SQL, and more — within each topic.

Developer-Friendly UI

Read and copy code in a clean, distraction-free interface with optional dark mode for longer study sessions.

Education-first product

Structured digital learning materials with immediate access after purchase

Clear pricing

Subscriptions and one-time collections described before checkout

Refund policy

Published windows for subscriptions and collections

TLS & privacy

HTTPS and a published Privacy Policy for account data

Start practicing today

Create a free account, browse exercises, and start solving. Upgrade for full access when you are ready.

Refund windows and subscription terms are published in our Refund Policy.