How Python Runs Your Code (The Interpreter Explained)
Python Code Is Plain Text
Python code is just plain text: letters, numbers and symbols, like a message. You could even write it in a simple notes app.
When you save Python code on a computer, you put it in a file whose name ends with .py, for example hello.py. That ending tells the computer: "this file holds Python code".
| File name | What it holds |
|---|---|
notes.txt | Plain text notes |
photo.jpg | A picture |
hello.py | Python code |
Most programmers write code in a code editor, an app made for writing code. A code editor colours the different parts of your code and warns you about some mistakes while you type. On LivePython, every lesson already has a small code editor built in, so you don't need any other app.
Text alone does nothing
Here's the important part: a .py file on its own does nothing at all. It's like a recipe in a drawer. Someone has to read it and follow the steps.
For Python code, that "someone" is a program called the Python interpreter. You'll meet it in the next lesson.
Python code is just text, until Python runs it.
