A hands-on exercise series designed for experienced JavaScript developers who want to learn Python. Each exercise highlights the differences and similarities between the two languages, with built-in tests to verify your solutions.
- 20 exercises covering Python fundamentals through advanced topics
- Side-by-side comparisons of JavaScript and Python syntax
- Built-in tests that run when you execute each exercise file
- Solutions for when you get stuck (but try first!)
- Claude Code integration for an interactive, guided learning experience
- Solid understanding of JavaScript (ES6+)
- Python 3.10+ installed (download)
- A code editor (VS Code with Python extension recommended)
├── 01-basics/ # Syntax, variables, types
├── 02-collections/ # Lists, dicts, tuples, sets
├── 03-control-flow/ # Conditionals, loops, comprehensions
├── 04-functions/ # Args, kwargs, lambdas, scope
├── 05-oop/ # Classes, inheritance, dunder methods
├── 06-error-handling/ # Try/except, custom exceptions
├── 07-modules/ # Imports, packages, virtual environments
├── 08-file-io/ # Reading/writing files
├── 09-decorators/ # Function decorators
├── 10-generators/ # Generators and iterators
├── 11-context-managers/ # The 'with' statement
├── 12-type-hints/ # Static typing in Python
├── 13-testing/ # pytest basics
└── solutions/ # All exercise solutions
If you have Claude Code installed, use the /practice command for the best experience:
claude
# Then type: /practiceThe /practice skill provides:
- Guided progression through all 20 exercises
- Progress tracking with streaks and statistics
- Instant feedback when you run tests
- Helpful hints without giving away answers
- JS habit detection - it'll catch when you accidentally write
===instead of== - Encouraging (and playfully teasing) tutor personality
Commands:
| Command | Description |
|---|---|
/practice |
Show current exercise and progress |
/practice list |
List all exercises with completion status |
/practice [n] |
Jump to exercise number n |
/practice hint |
Get a hint for the current exercise |
/practice run |
Run tests for current exercise |
/practice solution |
Show solution (try not to peek!) |
Run the standalone command-line interface:
python3 cli.pyCLI options:
python3 cli.py # Interactive mode
python3 cli.py --list # List all exercises
python3 cli.py --progress # Show detailed progress
python3 cli.py --reset # Reset progress-
Clone this repository
git clone <repo-url> cd python-practice
-
Create a virtual environment (recommended)
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Work through exercises in order
- Each folder contains numbered exercises
- Read the comments/docstrings for instructions
- Run your solution:
python3 exercise_file.py - Check against solutions when done
| JavaScript | Python |
|---|---|
const/let/var |
No keyword needed (or use type hints) |
null |
None |
undefined |
No equivalent (use None) |
=== |
== (Python has no type coercion) |
true/false |
True/False |
console.log() |
print() |
[] (array) |
[] (list) |
{} (object) |
{} (dict) |
=> (arrow fn) |
lambda |
async/await |
async/await (similar!) |
class |
class |
this |
self (explicit parameter) |
import x from 'y' |
from y import x |
// comment |
# comment |
{ } blocks |
Indentation (4 spaces) |
camelCase |
snake_case |
Some exercises include tests. Run them with:
pip install pytest
pytest- Indentation matters - Python uses indentation instead of braces
- No semicolons - Line endings define statement boundaries
- Everything is an object - Even functions and classes
- Explicit is better than implicit - Python philosophy (see
import this) - Duck typing - "If it walks like a duck..."
Found an issue or want to add exercises? PRs welcome!
This project is licensed under the PolyForm Noncommercial License 1.0.0.
You are free to:
- Use, modify, and fork this project for personal or educational purposes
- Share your modifications with others
You may not:
- Sell this software or any derivative works
- Include this code in commercial products
See LICENSE for full details.