Lesson 1.1Lesson 1.1 · Python Fundamentals
Running Your First Python
Get Python on your machine, meet the interpreter, and run real code today - because you learn to code by running code
You do not learn to code by reading about it. You learn by running code, breaking it, and running it again - so first, let us get code running.
Every concept in this course is something you can try, not just read. That only works if you can actually run Python on your own machine - so before variables, before loops, before any theory, we set up the one thing that makes the rest real: a way to type code and see it do something.
This is the least glamorous lesson in the course and the most important. Get this working and everything after it becomes hands-on. We will install Python, meet the two ways to run it, write a real file, and print your first program - and along the way make friends with the error messages that are about to become your constant, useful companions.
Install once. Confirm with python --version. Edit -> save -> run -> read the error -> fix. Repeat forever.
Getting Python onto your machine
Python is free software you download once. Go to the official site, python.org, open the Downloads page, and get the latest Python 3 for your operating system. On Windows, run the installer and - this one matters - tick the box that says Add Python to PATH before you click Install; it lets you run Python by name from a terminal later. On macOS, run the installer package the same way. Many Macs and most Linux machines already ship a Python, but installing the current version from python.org keeps you on solid, up-to-date ground.
How do you know it worked? Open a terminal - Command Prompt or PowerShell on Windows, Terminal on macOS, your shell on Linux - and type one line:
python --versionIf you see something like Python 3.12.4, you are ready. (On some Macs and Linux systems the command is spelled python3 - if python reports an error, try python3 --version instead, and use python3 everywhere below.) Seeing a version number is the whole goal of this section: it means your computer now understands the word python. If instead you get 'command not found', the most common cause on Windows is the missed PATH checkbox - re-run the installer, choose Modify, and enable it.
One thing to make sure of: you want Python 3, the version this whole course uses. You may occasionally see references to Python 2 in old tutorials online - it is long retired, its print works differently, and none of its examples should be your starting point. Anything current from python.org is Python 3, so if you downloaded from the official site you are fine. On Windows, avoid the stub that opens the Microsoft Store when you first type python; installing directly from python.org and ticking the PATH box gives you the cleaner, more predictable setup.
Do not overthink the install. It is a means to an end, and if it fights you, an AI assistant or a two-minute search with your exact error text usually settles it. The reward on the other side is that everything else in this course becomes something you can actually do.
The interpreter and the REPL - talking to Python live
Python is an interpreter: a program that reads your instructions and carries them out immediately, line by line, rather than making you compile a whole program first. The friendliest face of that is the REPL - short for Read, Evaluate, Print, Loop. It reads what you type, evaluates it, prints the result, and loops back for more. It is a calculator that speaks Python, and it is the fastest way to poke at an idea.
Start it by typing python on its own in a terminal and pressing enter. The prompt changes to >>>, which means Python is now listening. Try a few lines:
>>> 2 + 2
4
>>> 12 * 4.5
54.0
>>> "tile " * 3
'tile tile tile '
>>> 240 / 18
13.333333333333334Each time you press enter, Python answers instantly. Notice it already does design-flavoured arithmetic: 12 * 4.5 is a room area, 240 / 18 is how many 18-unit tiles span a 240-unit wall. The REPL is where you test a single idea - what does this do again? - without the ceremony of a file. When you are done, type exit() or press Ctrl-D (Ctrl-Z then enter on Windows) to leave and return to the normal terminal.
One small convenience while you are in there: the REPL remembers the result of the last expression in a special underscore variable, _. So after 240 / 18 you can type _ * 2 to keep working with that answer. It is a nice touch for a chain of quick sums, and a reminder that the REPL is meant for conversation - you ask, it answers, you build on the answer.
The REPL is throwaway by design. Close it and everything you typed is gone. That is perfect for experiments and useless for anything you want to keep or repeat - which is exactly why the next section moves to files. A good rhythm as you learn is to explore an idea in the REPL until you understand it, then write it down in a .py file once you want to keep it.
Writing and running a .py file in an editor
A script file is your instructions saved to disk so you can run them again, share them, and build them up over time. Python files end in .py. You could write one in any plain-text editor, but a proper code editor makes the job far nicer - the near-universal choice, and the one this course assumes, is Visual Studio Code (VS Code), a free editor from code.visualstudio.com. Install it, then add its Python extension (from the Extensions panel) for colour-coded code, helpful hints, and a Run button.
Make a folder for this course, open it in VS Code, and create a new file called plan.py. Type this in:
room_length = 12
room_width = 4.5
area = room_length * room_width
print("Floor area:", area, "square metres")Save the file (Ctrl-S, or Cmd-S on a Mac). Now run it. The most reliable way, and the one worth learning because it works everywhere, is from a terminal. Open the built-in terminal (Terminal menu, New Terminal), make sure you are in the folder, and type:
python plan.pyYou should see Floor area: 54.0 square metres. That is your instructions, saved and executed on demand. VS Code also has a Run button (the triangle, top right) that does the same thing - use whichever you like, but knowing the python plan.py command means you are never stuck, because that is how scripts run on any machine, including the design software later modules reach.
print() and your first real program
You have already met the star of early Python: `print()`. It is a function - a named action you call by writing its name followed by parentheses - and its job is to display things on screen. Whatever you put inside the parentheses, it shows. Because a running script does its work silently, print() is how a script talks back: it is how you check a value, trace what happened, and report a result.
Here is a slightly fuller first program - a tiny estimator you can actually reason about:
# a quick paint estimate for one wall
wall_length = 6.0
wall_height = 3.0
coverage_per_litre = 10 # square metres one litre covers
wall_area = wall_length * wall_height
litres_needed = wall_area / coverage_per_litre
print("Wall area:", wall_area, "sqm")
print("Paint needed:", litres_needed, "litres")Run it and you get two clean lines of output. Read the flow: it names some numbers, does arithmetic on them, and prints the results - the whole shape of a useful script in seven lines. You can hand print() several things at once separated by commas, as here, and it puts a space between them automatically. This is the pattern you will repeat forever: gather inputs, compute, report. Change wall_length to 9.0, save, and run again - the numbers update. You just wrote and modified a program.
One detail worth noticing while it is small: a script runs top to bottom, one line at a time, in order. Python reads wall_length = 6.0, then the next line, then the next - so by the time it reaches wall_area = wall_length * wall_height, both names already hold values. Order matters: if you tried to use wall_area before the line that computes it, Python would not know what you meant. This straight-line, top-to-bottom flow is the default; Module 2 is where you learn to bend it - skipping lines with decisions, repeating them with loops - but everything rests on this simple reading order.
How to actually run code as you learn
The single habit that separates people who learn to code from people who only read about it is this: run everything. Do not let a code block in this course sit on the page. Type it (do not paste - typing builds memory), run it, then change one thing and run it again. Ask what if? constantly - what if that number were bigger, what if I removed a line, what if I broke it on purpose? The REPL is perfect for quick what-ifs; a .py file is where anything you want to keep lives.
And you will break it - immediately and often. When you do, Python prints a traceback: a block of red-ish text ending in an error type and message, like NameError: name 'aera' is not defined (a typo for area) or SyntaxError: invalid syntax. This is not the computer scolding you; it is the most useful feedback you will get. Read the last line first - it names the problem - and check the line number it points to. Nine times out of ten it is a typo, a missing quote, or a mismatched parenthesis. Fix one thing, run again.
Errors are the normal state of writing code, not a sign you are bad at it. Even career programmers spend much of their day looking at tracebacks; they are just faster at reading them. Adopt that mindset now - edit, run, read the error, fix, run - and you have the core loop that carries you through every remaining lesson. With Python installed and running, you are ready to learn what those values you have been printing actually are.
interpreter
The program that reads and runs your Python line by line
Python is interpreted, so there is no separate compile step - you run a file and it just goes.
REPL
The interactive Read-Evaluate-Print-Loop prompt (>>>)
Great for testing one idea fast; throwaway - close it and everything is gone.
print()
A built-in function that displays values on screen
Your script talks back through print(); it is how you check values and report results.
VS Code
A free, widely used code editor (plus its Python extension)
Not required to run Python, but makes writing, running and reading code far easier.
traceback
The error report Python prints when something goes wrong
Read the last line first - it names the problem. Errors are normal, not failure.
Workshop - install, run, and break your first script
The goal is not clever code; it is proving the whole loop works on your machine - write, save, run, read output, read an error. Once this is solid, every later lesson is playable.
Python 3 (python.org), a terminal, and VS Code with the Python extension (code.visualstudio.com). No design software required.
Goal: get Python running and execute your own file Inputs: a computer with internet, ~30 minutes Time: ~30 minutes
- 1Install Python 3 from python.org (on Windows, tick 'Add Python to PATH'). In a terminal, run
python --versionand confirm you see a 3.x version (trypython3ifpythonfails). - 2Open the REPL by typing
python. Compute three real things from your own work - a room area, a tile count, a rough cost - then leave withexit(). - 3Install VS Code and its Python extension. Create a folder for this course and a file
plan.py. Type in the paint-estimate program from this lesson (type it, do not paste). - 4Run it two ways: with the Run button, and from the terminal with
python plan.py. Confirm you get the same output both times. - 5Break it on purpose: misspell
printaspint, save, run, and read the traceback. Fix it. Then change the wall dimensions to your own room and run again.
You’ll walk away with
A working `plan.py` on your machine that prints a paint (or tile, or cost) estimate for a real room, plus a one-line note of the error message you triggered and how you fixed it.
Three altitudes on the same idea
Read the band that fits you — or all three.
Getting Python running locally is the gate to every studio automation later in this course. The same python script.py command you just learned is how you will one day run a drawing-renamer or a schedule-builder on a project folder. Install it once on your workstation now; the two minutes it takes is the entry fee for reclaiming hours of repetitive work down the line.
You do not need any design software to start - just Python and an editor. The paint and tile estimates in this lesson are exactly the flavour of quick calculation that fills an interiors day, and they run on a plain laptop. Get comfortable typing a few lines and pressing run; that alone will change how you handle a fiddly quantity or a what-if on a finish budget.
Set this up on your own laptop today, while you have time to experiment freely. Being fluent at 'make a file, run it, read the error' is a quiet superpower in a studio and an expectation in computational-design and BIM roles. The habit of running and breaking code that you build here is the same one the pandas, Grasshopper and Dynamo modules will lean on.
“I should read through the whole course first to understand it, then start writing code once it makes sense.”
Do it yourself
Run these in the REPL or a file - do not just answer on paper.
- 1What does typing
python --versionin a terminal tell you, and why check it? - 2What is the difference between the REPL and a saved .py file - when would you reach for each?
- 3Write and run a two-line script that prints your name and today's rough tile count for one wall.
- 4You run a script and see
NameErroron the last line. What is the first thing you do? - 5Why is typing out each code example better than copying and pasting it?
The one line to carry out
Peer-reviewed journals & authoritative standards
- 01Welcome to Python.org — Python Software Foundation, 2026.
- 02The Python Tutorial — Python 3 documentation, 2026.
- 03Visual Studio Code — Microsoft, 2026.
- 04Integrated development environment — Wikipedia, 2026.
python --version. You can talk to it live in the REPL (the >>> prompt) for quick experiments, or save instructions in a .py file and run them with python file.py from a terminal or the Run button in VS Code. print() displays results, and the tracebacks you will see constantly are useful feedback, not failure - read the last line, fix one thing, run again.You can now run code. Next we look at what those values you have been printing actually are - how Python stores a number, a piece of text or a yes/no, using variables and data types.
The author
Amogh N P
Architect, interior designer, and creative polymath. Studio Matrx began in his notebooks — his vision of design made honest, useful, and open to everyone. Its Academy is written and taught in his memory, and free, forever.
More about Amogh →