Skip to content

marisiromanillos/Python-exercises

Repository files navigation

🐍 Python for TypeScript Developers

A structured exercise repo designed specifically for full-stack TypeScript/JavaScript developers learning Python. Every exercise shows the TypeScript equivalent side-by-side so you can leverage what you already know.

Who this is for

You already know TypeScript, Node.js, React/Astro/SolidJS, and backend frameworks like Express, Hono, or Elysia. You want to learn Python without starting from zero — mapping concepts you already understand to Python equivalents.

Structure

📁 01_beginner/          # Python syntax basics (1–2 hrs each)
📁 02_intermediate/      # Pythonic patterns & OOP (2–4 hrs each)
📁 03_advanced/          # Decorators, generators, async (3–5 hrs each)
📁 04_expert/            # Metaclasses, concurrency, build a FastAPI server

Each exercise folder contains:

  • README.md — instructions + the TypeScript equivalent for context
  • exercise.py — the file you edit (has TODO comments)
  • solution.py — reference solution (try not to peek!)
  • test_exercise.py — pytest tests to verify your work

Setup

# Python 3.11+ recommended
python --version

# Install pytest for running tests
pip install pytest

# Run all tests for a specific exercise
cd 01_beginner/01_variables_and_types
pytest test_exercise.py -v

# Run all tests in the repo
pytest --tb=short

Progression

Level Folder Concepts Est. Time
🟢 Beginner 01_beginner/ Types, strings, lists, dicts, control flow, functions 8–10 hrs
🟡 Intermediate 02_intermediate/ Comprehensions, classes, modules, file I/O, exceptions 10–15 hrs
🔴 Advanced 03_advanced/ Decorators, generators, async/await, protocols 15–20 hrs
⚫ Expert 04_expert/ Metaclasses, descriptors, concurrency, FastAPI project 20+ hrs

TypeScript → Python Mental Model

When you think... In Python it's...
const / let Just assign: x = 5
interface Protocol (structural) or TypedDict
type MyType = ... TypeAlias or just a variable
Array<T> list[T]
Promise<T> Coroutine[T] + asyncio
async/await Same! But needs asyncio.run()
try/catch try/except
throw new Error() raise ValueError()
...spread *args / **kwargs
JSON.parse() json.loads()
Express route app.get(...) FastAPI @app.get(...)

About

A structured exercise repo designed specifically for full-stack TypeScript/JavaScript developers learning Python. Every exercise shows the TypeScript equivalent side-by-side so you can leverage what you already know.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages