Please enable JavaScript to use CodeHS

Programming Concepts

Python 3 Quick Start

Run simple Python expressions in a browser REPL. Try math, variables, and functions to see how Python evaluates code.

Python ~10 min Middle / High school
The Big Idea

What is Python?

Python is a popular programming language known for readable syntax. In a REPL (Read, Evaluate, Print, Loop), you type one line at a time and immediately see the result.

The mini REPL below starts with two variables already defined: x = 5 and y = 15. It also has a function do_something(n) that returns n * 2. Try typing expressions and assignments.


Interactive

Try it: Python REPL

Type a Python expression or assignment and click Run. Examples: 2 + 3, x + y, z = 10, do_something(4).

Python 3 quick-start REPL. Variables x=5 and y=15 are defined. Try: 2 + 3, x + y, do_something(4)
>>>

How It Works

How a REPL works

  • Read: the computer reads what you typed.
  • Evaluate: it runs the code or computes the expression.
  • Print: it shows the result.
  • Loop: it waits for your next input.

Check Yourself

Quick quiz

1. What does 2 + 3 evaluate to?

2. If x = 5 and y = x + 10, what is y?

3. What does do_something(4) return?


Keep exploring

Explore more programming concept tutorials.

Part of the Programming Concepts tutorial series.