Python Practice (Interactive)
Intuition
Learning through practice: Practice problems are like training drills — they help you apply knowledge and identify areas that need more study.
Why it matters: Regular practice builds confidence and reveals patterns in how concepts are tested. Each problem reinforces key programming concepts.
The key insight: Making mistakes during practice is valuable — each error points to a concept that needs clarification.
Python — Interactive Practice
13 auto-graded practice problems covering core Python concepts. Select an answer, submit, and review the explanation.
Data Structures
Functions and Scope
Core Language Features
List Comprehensions
Generators
Decorators
Context Managers
Asyncio
Advanced Functions
Cross-References
- Python Flashcards: Interactive flashcards covering core Python concepts.
- Python Practice: Foundational Python practice problems.
- Packaging and Distribution: Package management and distribution best practices.
Common Mistakes
Using mutable default arguments: def f(a, b=[]): shares the same list across all calls. Use b=None and b = b or [] inside the function to create a fresh list each time.
Confusing is with ==: is checks identity (same object in memory); == checks equality. Using is for value comparison fails for integers outside the cached range and for strings.
Forgetting that generators are exhausted: A generator can only be iterated once. Iterating it a second time yields nothing. Convert to a list with list(gen) if you need multiple passes.