Phase: 0. Orientation | Estimated time: 2 hours | Milestone Project: No
- Module 000: Introduction to Python — basic context about the language
By the end of this module, you will be able to:
- Verify Python 3.12 is installed on your system
- Navigate the filesystem using basic terminal commands (
pwd,ls,cd) - Open and use VS Code for editing Python files
- Run a Python script both from the terminal and from within VS Code
- Create your first
.pyfile
You can't write Python without a working environment. A properly configured setup — terminal, editor, and Python interpreter — is the foundation every developer builds on. Spending time here saves hours of frustration later.
Python does not come pre-installed on all systems, or it may ship with Python 2 (macOS). You need Python 3.12 specifically.
- Go to python.org/downloads
- Download the Python 3.12 installer for Windows
- Important: Check "Add Python to PATH" during installation
- Open Command Prompt and type
python --version
- Install Homebrew from brew.sh if you don't have it
- Run
brew install python@3.12 - Verify with
python3 --version
- Run
sudo apt update && sudo apt install python3.12 - Verify with
python3.12 --version
The terminal (also called shell or command line) is a text-based interface to your computer. You will use it constantly as a developer.
| Command | What it does | Example |
|---|---|---|
pwd |
Print Working Directory — shows where you are | /home/student |
ls |
List files in the current directory | ls |
cd |
Change Directory — move somewhere else | cd Desktop |
cd .. |
Go up one directory | cd .. |
mkdir |
Make a new directory | mkdir myproject |
clear |
Clear the terminal screen | clear |
VS Code is a free, lightweight code editor by Microsoft. It has excellent Python support through extensions.
- Download from code.visualstudio.com
- Install the Python extension by Microsoft (search Extensions panel)
- Open a folder: File → Open Folder
- Create a new file: File → New File → save as
hello.py
There are two main ways to run Python:
Interactive mode (REPL):
$ python3
>>> print("Hello!")
Hello!
>>> exit()
Script mode (run a .py file):
$ python3 hello.py
Hello!
The REPL is great for experimenting. Script mode is for real programs.
Create a file called hello.py and add:
print("Hello, World!")Save it, then run:
$ python3 hello.py
Hello, World!
- "Python is not recognized" on Windows: You forgot to check "Add Python to PATH". Re-run the installer and check the box.
- Using
pythoninstead ofpython3on macOS/Linux: On these systems,pythonoften points to Python 2. Always usepython3. - Typos in terminal commands:
cdrequires a space between the command and the directory name. - Forgetting to save before running: If you edit your
.pyfile but don't save, you will run the old version. - Running from the wrong directory: Use
pwdandlsto confirm you are where you think you are.
Follow along step by step:
- Open your terminal.
- Type
python3 --version(orpython --versionon Windows). You should see something likePython 3.12.x. - Create a project folder:
mkdir ~/python-intro cd ~/python-intro - Open VS Code from the terminal:
code .(the dot means "current directory"). - Create a new file called
hello.pyand write:print("Welcome to Python 3.12!")
- Save the file (Ctrl+S / Cmd+S).
- Back in the terminal, run:
python3 hello.py - You should see
Welcome to Python 3.12!printed.
- Always use Python 3 (check with
python3 --versionorpython --version). pwd— where am I?ls— what's here?cd— take me somewhere else.- VS Code with the Python extension is a great editor for beginners.
- Python runs in two modes: interactive REPL and script mode.
- A
.pyfile is just a text file with Python code inside. - Save your file before running it.
- Use
exit()or Ctrl+D to leave the REPL.
- Python Beginners Guide / Download (python.org)
- VS Code Python Tutorial (code.visualstudio.com)
- Command Line Crash Course (learnpythonthehardway.org)
Let's write real code! Module 002: Your First Python Program teaches the print() function and basic program structure.