Master Python completely β from first program to advanced patterns β with every concept compared side-by-side to JavaScript so you learn twice as fast.
Developers who already know JavaScript / Node.js and want to learn Python quickly by mapping what they already know.
- Basic understanding of JavaScript (variables, functions, loops, classes)
- Node.js installed (for JS comparisons)
- Python 3.10+ installed
# Verify both are installed
node --version # JS runtime
python3 --version # Python runtimepython-lessons/
βββ README.md β You are here (master index)
β
βββ 01_setup.md β Installation, REPL, first program
βββ 02_variables.md β Variables, types, type conversion
βββ 03_strings.md β Strings, f-strings, all methods
βββ 04_numbers.md β Numbers, math operators, math module
βββ 05_control_flow.md β if/elif/else, loops, break/continue
βββ 06_lists.md β Lists, slicing, comprehensions
βββ 07_tuples.md β Tuples, packing, unpacking
βββ 08_dictionaries.md β Dicts, methods, dict comprehensions
βββ 09_sets.md β Sets, operations, use cases
βββ 10_functions.md β def, args, kwargs, lambda, scope
βββ 11_decorators.md β @decorator, closures, functools
βββ 12_generators.md β yield, generator expressions, lazy eval
βββ 13_oop_basics.md β Classes, __init__, self, methods
βββ 14_oop_advanced.md β Inheritance, magic methods, dataclass
βββ 15_modules.md β import, packages, __name__
βββ 16_pip_venv.md β pip, virtual environments, requirements
βββ 17_file_handling.md β open(), read, write, with statement
βββ 18_error_handling.md β try/except/finally, custom exceptions
βββ 19_json_csv.md β json module, csv module
βββ 20_stdlib.md β os, sys, pathlib, datetime, random, re
βββ 21_type_hints.md β Type annotations, typing module, mypy
βββ 22_async.md β async/await, asyncio, httpx
βββ 23_regex.md β re module, patterns, match/search/sub
βββ 24_collections.md β Counter, defaultdict, deque, namedtuple
βββ 25_testing.md β pytest, assertions, fixtures, mocking
βββ 26_best_practices.md β PEP 8, clean code, tools
Get Python running and understand the basic building blocks.
Make decisions and repeat operations.
Python's powerful built-in collections.
Write reusable, expressive, Pythonic functions.
Design programs with classes and objects.
Organise code and use Python's massive library ecosystem.
Read files, process data, handle failures.
Standard library, type hints, async, regex, collections.
Write code that works, lasts, and others can read.
| JavaScript | Python | Notes |
|---|---|---|
let / const |
just = |
No declaration keyword |
console.log() |
print() |
Output |
null |
None |
No value |
true / false |
True / False |
Capital letters! |
=== |
== |
Python has no === |
{} blocks |
indentation | 4 spaces = block |
Array |
list |
Most methods differ |
Object |
dict |
Keys must be quoted |
function / => |
def / lambda |
|
class + constructor |
class + __init__ |
|
this |
self |
Must be explicit |
try/catch |
try/except |
|
...spread |
*args / **kwargs |
|
async/await |
async/await + asyncio |
|
| Template literals | f-strings | f"Hello {name}" |
# Download from https://python.org
python3 --version # verifyVS Code + Python extension (IntelliSense, linting, debugging)
python3 -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windowsecho 'print("Hello, World!")' > hello.py
python3 hello.pyEach lesson file follows this structure:
π― What you'll learn
π JS vs Python comparison (side by side)
π‘ Key concepts explained
π§ͺ Code examples with output
β οΈ Common mistakes / gotchas
π What to learn next