Comprehensions, Iteration, and Pythonic Data Work Python practice problems
Comprehensions, enumerate, zip, sorting keys, lambda, map/filter, and readable transformations.
Core concepts
Problem-solving patterns
- lambda · sorting
- map · lambda
- filter · predicate
- reduce · operator
- iterator · StopIteration
What this topic builds
Learn the idea once, use it across the exercises, and explain why your approach works.
All 10 problems in this topic
Work from top to bottom to build the concept gradually.
- #171Sort records with a lambda: LeaderboardBeginnerPremium
Sort competitors by score, highest first.
- #172Sort records with a lambda: Tie by nameBeginnerPremium
Use the name as a predictable tie breaker.
- #173Square values with map: Positive sequenceIntermediatePremium
Square a short sequence of positive integers.
- #174Square values with map: Signed sequenceIntermediatePremium
Observe that squaring negative and zero values produces nonnegative results.
- #175Filter passing scores: Standard pass markIntermediatePremium
Keep all scores that meet a pass mark of 60.
- #176Filter passing scores: Everyone passesIntermediatePremium
Handle a threshold met by every score.
- #177Multiply values with reduce: Package combinationsIntermediatePremium
Multiply option counts to find the number of package combinations.
- #178Multiply values with reduce: Zero factorAdvancedPremium
Show that any zero factor makes the whole product zero.
- #179Create a countdown iterator: Custom countdownAdvancedPremium
Iterate from three to zero using the iterator protocol.
- #180Create a countdown iterator: Iterator edgeAdvancedPremium
A countdown starting at zero still yields one element.