Learn Python by running it.

Change one line, press Run and see what happens. Nothing to install and no account needed.

Today's code · Monday

Countdown

Press Run to see the output here.

Start the countdown from a different number. Open the full editor →

Newest articles

Discover the latest in space science and Python programming. Our newest articles blend astronomy concepts with coding challenges to fuel your cosmic curiosity.

All articles →
A robot standing next to a Japanese restaurant, the cover image for an article on whether learning Python is still worth it in the age of AI

Is It Worth Learning Python in the Age of AI? (2026)

AI now writes a large share of new code, so is learning Python still worth your time? Yes, but for a different reason than ten years ago. Using job data, developer surveys and recent studies on learning with AI, we look at what changed and where Python’s

Beginner’s guide to Python functions: code example with def, parameters and return

Python Functions for Beginners

Learn to write your own Python functions, from your first def to return values, default parameters and scope, with runnable examples, common mistakes and six practice projects.

Converting decimal numbers to Rocky's base-6 Eridian number system in Python

Base 6 Number System in Python

In Project Hail Mary, the alien engineer Rocky counts in base 6 because he has two hands with three fingers each. In this article, you'll build Python programs that convert between decimal, base-6, and Eridian notation.

New in the community forum

Questions and answers from other people learning Python.

Go to the forum →

Quiz of the week

A different quiz every Monday. How many will you get right?

All quizzes →

Today's challenges

Three challenges, different every day. Fix or write the code and let the tests check it.

All challenges →

Any number of values

Write average(*values), which accepts any number of numbers, call it with loose values and with a list unpacked by *, then add a keyword-only decimals option after *values and return None when there are no values.

  • Write the code
  • Easy
  • 2 stages

Extra log fields

Extend format_log() from "Log formatter function" with **fields, so any extra keyword arguments are added to the line as key=value pairs, then pass whole dicts of fields into it with ** at the call.

  • Write the code
  • Medium
  • 2 stages

Shared default list

add_sample(sample, log=[]) remembers samples from earlier calls, because the default list is created once and shared. Predict it, prove the calls share one list, fix it with None as the default, then write a function that hands out a fresh list each time.

  • Fix the code
  • Medium
  • 3 stages

Today's examples

Three short programs to read, run and change. A new set tomorrow.

All examples →

If-else Statement

The else block executes when if condition is not met. Two possible paths.

  • Audio
  • if
  • else
  • condition

If-elif-else Statement

Multiple conditions with elif. Checking several possibilities in sequence.

  • Audio
  • if
  • elif
  • else

Join the programmers learning Python here

A free account saves your progress on paths, quizzes and challenges, keeps the code you write, and lets you ask and answer in the community.