Lesson 04 - Hello World
Your First Instruction to the Machine
Introduction
At some point in your career, you drew your first line in CAD. It wasn't remarkable, and it certainly wasn't architecture yet. But it confirmed something important: the machine responded exactly to what you told it to do.
This lesson is that same moment, just in a different medium.
You're not learning "programming" yet. You're learning how to give a clear instruction and observe the result.
Lesson Overview
This section contains a general overview of topics you will learn in this lesson.
- Understand how Python executes code (top to bottom, left to right)
- Learn what syntax means
- Write your first Python program using
print() - Run a Python file in VS Code
- Understand what's happening when you run code
- Build trust in the language
Why Python Feels Manageable
Python works for architects because it's readable. What you type looks like what you mean.
Minimal ceremony. Minimal noise. Often, you write a thought. The computer follows it.
This is intentional. Python was designed for humans first.
How Python Executes Code
Before writing anything, understand how Python behaves.
Python reads your code in a very predictable way. It goes from top to bottom and from left to right. No guessing. No hidden behavior.
Whatever you write is executed in the exact order you write it. This predictability is one of Python's biggest strengths, especially as your scripts grow.
A Quick Note on Syntax
You'll hear the word syntax often. It simply means the grammar rules of a programming language.
Just like drawings have line weights, layers, and naming conventions, Python has its own grammar.
The good news? Python's syntax is minimal by design.
We'll only introduce new rules when they become necessary.
Writing Your First Line of Python
For this lesson, we'll run Python outside Revit or Grasshopper. Think of this as a neutral learning sandbox where nothing can break.
Step 1: Open VS Code
Open Visual Studio Code.
Step 2: Create a New Python File
Create a new file and save it as:
hello_world.py
The .py extension tells your computer that this file contains Python code.
Step 3: Write the Code
Type the following exactly:
print("Hello World")
No setup, no configuration, nothing else required.
Step 4: Run the File
Click the Run ▶ button in the top-right corner of VS Code.
You should see the following output:
Hello World
You just wrote and executed your first Python program.
What Just Happened?
Let's break down the line you wrote.
print("Hello World")
The word print is a built-in Python instruction that means "show this to me."
The text inside the quotes is the message you want displayed.
When you pressed Run, Python read your instruction, translated it, and displayed the result. You did not explain how to display the text. You only stated what you wanted.
That separation is important.
An Important Mental Model
Python is not clever or intuitive. It is precise and obedient.
If something doesn't work later, it's usually because the instruction was unclear or written in the wrong order. It's almost never because you're "bad at coding."
Practice
Replace your code with the following:
print("This is my first lesson in Python")
print("I am an Architect")
print("And I am learning Python for Architects")
Run the file again and observe what happens.
Each line prints separately. Python executes the file from top to bottom. The order you write is the order you see.
Change the text. Add your name. Nothing breaks. This is a safe space to experiment.
Assignment
- Create a new file called
introduction.py - Use the
print()function to display the following:- Your name
- Your current role (e.g., "Architectural Designer")
- One reason you're learning Python (e.g., "To automate sheet creation")
- Run the file and verify the output
- Experiment: change the text, add more lines, see what happens
Knowledge Check
The following questions are an opportunity to reflect on key topics in this lesson.
- How does Python read and execute code?
- What does "syntax" mean?
- What does the
print()function do? - Why is Python described as "precise and obedient"?
- What happens when you run multiple
print()statements in a row?
Additional Resources
This section contains helpful links to related content. It isn't required, so consider it supplemental.
- Python Official Tutorial — comprehensive but dense. Useful later when you want to dive deep
- If you want to experiment without installing anything, try Python Tutor to visualise how code executes line by line