Back to blog
Run Python online beginners guide Python · Beginner

Run Python online in 10 minutes: print, loops & functions

No download, no install, no account. Learn the 5 basics that cover 80% of beginner Python — with live code you can run right now in your browser.

Installing Python is where most beginners quit: versions, PATH checkboxes, pip errors. Skip it. Open the FastCompiler Python compiler — real CPython 3.12 via Pyodide in your browser — and learn by running, not by configuring. Everything below was tested there.

1. Print and variables — your first 30 seconds

name = "Juwel"
age = 21
print(f"Hello, {name}! Next year you turn {age + 1}.")

Two rules: strings need quotes, f"..." lets you embed {expressions}. Try breaking it — remove a quote and press Run. The Traceback tells you the exact line. Reading tracebacks early is the skill.

2. If/else — decisions

score = 78
if score >= 90:
    print("A")
elif score >= 70:
    print("Pass — keep going")
else:
    print("Retry")

Indentation is syntax: 4 spaces per block. Mixing tabs and spaces is the #1 beginner error — the compiler highlights it immediately.

3. For loops — repetition without copy-paste

for i in range(5):
    print(f"Step {i}: {i * i}")

cart = [12, 7, 25]
total = 0
for price in cart:
    total += price
print("Total:", total)

range(5) gives 0–4. Loop over the list directly (for price in cart), not indexes — more Pythonic, fewer bugs.

4. While loops — repeat until done

n = 5
while n > 0:
    print(n)
    n -= 1
print("Liftoff!")

If your program hangs, you wrote an infinite loop (forgot n -= 1). Refresh the tab — nothing is uploaded, so nothing breaks.

5. Functions — reusable blocks

def greet(name, greeting="Hello"):
    return f"{greeting}, {name}!"

print(greet("Asha"))
print(greet("Rahim", greeting="Welcome"))

def is_even(n):
    return n % 2 == 0

print([x for x in range(10) if is_even(x)])

def defines, return gives back. Default arguments (greeting="Hello") make functions flexible. The last line is a list comprehension — worth learning week two.

Debugging checklist when output surprises you

  • Read the last traceback line first — it names the error (NameError, IndentationError, TypeError) and line number.
  • Print types: print(type(x), repr(x)) reveals '5' string vs 5 int bugs.
  • Shrink it: comment out half, Run, repeat. Binary search beats staring.
  • Check Python version assumptions: this is 3.12 — print is a function, / is float division.

What browser Python can't do (honestly)

File paths are virtual, some C-extension packages and system calls are limited, and the first load downloads ~8MB Pyodide (then cached offline). For automation scripts touching your real filesystem or heavy pandas jobs, install Python locally later. For learning, interviews and small tools — the browser is faster.

Next: JavaScript map/filter/reduce uses the same thinking in another language, and the docs explain how FastCompiler stays offline. Practice the five blocks above in the Python compiler until you can write them from memory.

Run every snippet above live — no download, no sign-up.

Open the Python compiler