Python, from zero

A hands-on start. Every snippet below actually runs, right here in your browser.

Most tutorials make you install things before you write a single line. Not here. Every code cell on this page runs real Python in your browser, no setup, no server. Hit Run and watch. The first run takes a moment while Python wakes up, then it is instant.

Hello, world

The classic. Change the text and run it again.

python⌘↵ to run

Variables and math

Python figures out the types for you. Try changing the radius.

python⌘↵ to run

Loops

Counting is where it clicks. This prints the first few squares.

python⌘↵ to run

Reading code vs running it

Sometimes you just want to show a snippet, not run it. A normal code block still looks the part:

greet.py
def greet(name: str) -> str:
    return f"Hey, {name}"

Where to go next

That is enough to be dangerous. Real programs are just these small pieces, stacked. Write more, run more, break more. The fastest way to learn is to change a line and see what happens.

Adrishyam: Dehazing Images with CV