This is Python · medium, lesson 1: Comprehensions. Read the teaching and the stills before the checks. The quizzes are open book and test the subject — Python itself — not product rules or layout trivia.

Python Medium · Lesson 1 · On the house
Comprehensions
Build a list in one honest line. Lesson 1 is free — on the house.
Lessons · Python Medium · Lesson 1 of 10 · On the house
Comprehensions
Build a list in one honest line.

You already know Introductory and Easy. Medium assumes those habits and asks for sharper tools.
[n * n for n in range(4)] builds [0, 1, 4, 9].
Add if filters after the iterable.
Nested comprehensions exist — prefer clarity.
Generator expressions use parentheses and stay lazy.
comp
squares = [n * n for n in range(4)]
print(squares)Sit with that still. Trace it top to bottom. Name each piece. The exercise asks you to match its essence.
If something fails when you try it yourself, change one thing. Read the error. Return to the still. I will not rush you.
Quiz
What is [n * n for n in range(4)]?
Quiz
What does a comprehension replace well?
Quiz
How do you filter in a comprehension?
Quiz
Based on today's teaching, which claim is right?
Quiz
Based on today's teaching, which claim is right?
Quiz
Based on today's teaching, which claim is right?
Quiz
Based on today's teaching, which claim is right?
Quiz
Based on today's teaching, which claim is right?
Check
Match the still for: Comprehensions.
That is the lesson. When every quiz and exercise on this page is green, mark it passed. Next lesson when you are ready.
Open-book: the answers are on this page. Pass every quiz and check (9) to mark the lesson done. This visit: 0/9.