---
title: Interactive Mode vs Script Mode in Python
source: https://app.sythra.ai/learn/python/interactive-mode-vs-script-mode
topic: Python
updated: 2026-08-12
publisher: Sythra (https://app.sythra.ai)
---

# Interactive Mode vs Script Mode in Python

Interactive mode (the Python REPL) runs code line by line and automatically shows the value of any expression you type. Script mode runs a whole .py file at once and stays silent unless you explicitly print() something.

_Source: [https://app.sythra.ai/learn/python/interactive-mode-vs-script-mode](https://app.sythra.ai/learn/python/interactive-mode-vs-script-mode) — free to read on Sythra._

## Key points

- Interactive mode = REPL, one line at a time, auto-displays expressions
- Script mode = runs a .py file, silent unless you print()
- Same code, different behavior — this is not a bug
- Open interactive mode by typing python in a terminal
- Run a script with python filename.py
- Use interactive mode to experiment, script mode to build

Type `miles * 1.61` in one place and Python shows you the answer instantly. Paste the exact same line into a `.py` file, run it, and... nothing. No error, no output, silence. That is not a bug — it is the difference between **interactive mode** and **script mode**, and mixing them up is one of the first beginner traps in Python.

This page shows exactly what changes between the two, why script mode looks broken until you add `print()`, and how to open each mode on your machine. Pair it with [Statements vs Expressions](/learn/python/statements-vs-expressions) for why expressions auto-display in one mode but not the other.

## What you will learn

By the end you can:

- Explain the difference between Python's **interactive mode** and **script mode**
- Know why expressions auto-print in one mode but stay silent in the other
- Open the interactive interpreter (REPL) from your terminal
- Write and run a `.py` script correctly
- Avoid the classic 'why is nothing printing' confusion

## Interactive mode — a conversation

Interactive mode is a live chat with Python. You type a line, Python replies immediately. It is often called the **REPL** (read–eval–print loop).

```python
>>> miles = 26.2
>>> miles * 1.61
42.182
```

Look closely at what happened: the first line is an **assignment** — no visible output. The second line is an **expression** — Python evaluates it and displays the result automatically. In interactive mode, typing a bare expression is enough to see its value; it feels like using Python as a calculator.

## Script mode — a written letter

Now put the same two lines into a file:

```python
miles = 26.2
miles * 1.61
```

Run that file. Nothing appears — no error, no output, silence. That is expected: in **script mode**, expressions do not display their result automatically. Python still evaluates them, but it only shows output when you explicitly ask for it.

```python
miles = 26.2
print(miles * 1.61)
# 42.182
```

> **Rule of thumb:** 

## How to open each mode

**Interactive mode:** open the Command Prompt (Windows) or Terminal (macOS/Linux), type `python` (or `python3`), and press Enter. A `>>>` prompt appears, letting you run commands one at a time.

**Script mode:** open any text editor or IDE (VS Code, IDLE, PyCharm), write your code in a file ending in `.py`, save it, then run the file — for example `python my_script.py` — to execute the entire program at once.

## When to use which

| Situation | Best mode |
| --- | --- |
| Testing a quick idea or formula | Interactive mode |
| Exploring what a function returns | Interactive mode |
| Building a real, reusable program | Script mode |
| Something teammates or a server will run repeatedly | Script mode |

## Common mistakes

- Writing a script, expecting bare expressions to print like the REPL does
- Assuming a silent script means it crashed — it may have run fine with no `print()`
- Copy-pasting `>>>` prompts into a `.py` file (syntax error — the prompt itself is not code)
- Forgetting that variables set in one interactive session disappear when you close it

## Why this matters

Every Python programmer lives in both worlds: the REPL for fast experiments, scripts for anything that needs to run more than once. Knowing which mode you are in — and that script mode stays silent unless told otherwise — removes a whole category of "my code isn't working" confusion before it starts.

> **Practice with Sythra:**  [Practice with AI tutor](https://app.sythra.ai/pricing)

## FAQ

### What is the difference between interactive mode and script mode in Python?

Interactive mode (the REPL) runs code one line at a time and automatically displays the value of any expression. Script mode runs an entire .py file at once and only shows output when you explicitly call print().

### Why does my Python script show no output?

In script mode, bare expressions do not auto-display like they do in interactive mode. If a line just computes a value without printing it, nothing appears. Add print() around the value you want to see.

### How do I start Python's interactive mode?

Open a terminal or command prompt and type python (or python3), then press Enter. The >>> prompt appears, letting you run one line of code at a time.

### How do I run a Python script?

Save your code in a file ending in .py, then run it from the terminal with a command like python filename.py.

### Is the Python REPL the same as interactive mode?

Yes. REPL stands for read-eval-print loop, which describes exactly what interactive mode does: read your input, evaluate it, print the result, and loop back for more.

## Related

- [Statements vs Expressions in Python](https://app.sythra.ai/learn/python/statements-vs-expressions) — Why expressions produce values that interactive mode shows automatically.
- [Programs, Interpreters & Compilers in Python](https://app.sythra.ai/learn/python/programs-interpreters-compilers) — How Python actually runs the code you write.
- [Variables in Python](https://app.sythra.ai/learn/python/variables) — Assignments look silent in both modes — here's why.
- [Order of Operations in Python](https://app.sythra.ai/learn/python/order-of-operations) — Try precedence examples live in interactive mode.
- [The input() Function in Python](https://app.sythra.ai/learn/python/python-input-function) — Reading user input and converting it from a string to a number.
- [Python course hub](https://app.sythra.ai/learn/python) — All free Python explainers and the path into Agentic practice.

---

Written by Sythra — Learn machine learning by building. Practice this topic with Sythra's AI tutor: https://app.sythra.ai/pricing
