Python 3
Course Syllabus
Please note that this Python syllabus serves as a standard overview.
I always adapt the course to align with my students’ needs and the specific expectations of each institution I work with.

Course Overview
My course is usually focused on acquiring fundamental knowledge on the Python language, including its syntax,
standard rules (to become a real Pythonista 😉), and standard modules from the Python Standard Library (PSL).
As a 3d game developer, I will mostly give examples on game dev.
Python Syllabus Overview
Python Overview
- High-level language (close to natural languages)
- Python philosophy: readability, simplicity, expressiveness (The Zen of Python)
- Use cases: Web, Data Science, AI, Scripting, Automation
- Downloading the Python interpreter and the Visual Studio Code text editor
- Terminal: checking Python, PIP, and Virtual Environment
- Execution Mode
Execution Modes
- Interactive: REPL (Read-Eval-Print Loop)
- Script: executing a
.py file
- Jupyter Notebook: optional, widely used in Data Science
- Comments: single-line (
#) or multi-line ('''docstring''')
- Indentation: 4 spaces per level (instead of curly braces
{} used in other languages)
- Output & Input:
print(), input()
Variables & Simple Types
- Value assignment/affectation
- Dynamic typing
- Absence of value:
None
- Numeric:
int (integer), float (decimal), complex (complex number)
- String:
str
- Boolean:
bool
Variable Collections
- Lists: Ordered elements (indexed) and mutable, similar to arrays
- Tuples: Ordered elements but immutable; faster than a list
- Sets (and frozensets): Unordered and mutable elements;
frozenset is an immutable variant
- Dictionaries: Key/value pairs, similar to JavaScript objects
Operations
- Arithmetic: PEMDAS (order of operations: Parentheses, Exponents, Multiplication/Division, Addition/Subtraction)
- Special Arithmetic Operators:
// (floor division), % (modulo), ** (exponentiation)
- Comparison:
==, !=, <, >, <=, >=
- Logic:
and, or, not
Control Structures
- Conditions:
if, elif (else if), else
- Loops:
for, while
- Flow Control:
break, continue, pass
Programming Paradigms
- Imperative: instructions executed step-by-step
- Procedural: functions (mandatory parameters, optional parameters, arguments)
- Object-Oriented: classes, instances/objects, properties (attributes), and methods
Modules & PSL
- Importing:
import, from ... import ...
- Python Standard Library:
datetime, math, os, random, sys

Python Introduction
Python is a general-purpose, multi-paradigm, high-level programming language created by Guido van Rossum, and first released in 1991.
Its philosophy emphasizes code readability and simplicity, summed up in the famous “Zen of Python” you can read in any Python interpreter by typing import this.
In this day and age, Python is one of the most popular programming languages in the world, according to multiple rankings such as the TIOBE Index, GitHut, and IEEE Spectrum.
It powers everything from web backends and data analysis to machine learning, automation, game development (mostly as a glue or automation language), and scientific research.
Behind the scenes, the standard version of Python (called CPython) is built using the C programming language.
We say it’s implemented in C.
Game Dev with Python
Many guides state that Python is heavily used in game development, which isn’t really the case.
Python might be used for simple and small-scale 2D games with libraries like Arcade or Pygame.
For modern 3D games, Unreal Engine, Unity, or Godot might be much more interesting.
However, you can still use Panda3D, probably the most known game engine that uses Python, apart from the deprecated Blender Game Engine (BGE), removed in Blender 2.8 but later revived independently as UPBGE (which is not linked nor maintained by the Blender Foundation).
However, note that Panda3D doesn’t have a Level Editor, and is mostly under maintenance nowadays.
For AAA games, Panda3D may not match the raw power of engines like Unreal Engine or Unity.
C# with Unity is a good experience that can match Python ease of use, compared to Unreal C++ which is far more complex (often described as lower-level compared to Unity’s C#).
Many also associate Python with the Godot engine, due to its custom scripting language, GDScript, which looks like Python. However, GDScript is not derived from Python, and the two should not be confused.
Finally, Python is used as an automation language, in game engines like Unreal Engine or in 3D DCC like Blender, Autodesk Maya, or Autodesk 3DS Max.
Note on Generative AI
Generative AI is a huge topic in programming and technology, with many opinions floating around on social media or anywhere else.
First, many tools such as website chabots like Claude, Grok, ChatGPT, and Gemini can help to experiment and learn a tremendous amount of things with Python.
However, truly learning and memorizing Python (syntax, data types, control flow, etc.) is the only reliable way to create complex, scalable, and maintainable projects.
Vibe coding, i.e., generating code via prompts without deeply understanding its logic, will leave a very large number of problems that will grow.
Knowing the language deeply means you can debug, optimize, and extend your code instead of relying on guesswork.
I firmly believe that generative AI tools are incredible for learning, brainstorming, and finding solutions to fix bugs, but that’s all they are.
Python Technical Specs
- Interpreted: Bytecode compilation to Python Virtual Machine (PVM) with line-by-line interpretation at runtime, eliminating explicit ahead-of-time native compilation phase.
- Platform Agnosticism (cross‑platform): Write-once-run-anywhere portability across major operating systems (Windows, macOS, Linux/Unix distributions) via the CPython interpreter & standard library abstraction layers.
- Dynamically typed: types are checked at runtime.
- Garbege-collected: memory management is handled automatically.
- High-Level Data Structures: Built-in mutable and immutable collections including lists (dynamic arrays), dictionaries (hash tables), sets (unordered unique elements), and tuples.
- Comprehensive Standard Library: Batteries-included philosophy with extensive modules for I/O, networking, concurrency (threading, multiprocessing, asyncio), text processing, and metaprogramming.
Getting Started!
Install Python & Visual Studio Code
Python
- Download the official Python interpreter from python.org for Windows, macOS, and Linux.
- Installation Wizard configuration on Windows (Add Python to PATH, etc.).
- On most Linux distros, Python is often pre-installed.
- On Windows, Python can be installed using Chocolatey.
Visual Studio Code
- Download the Visual Studio Code text editor & Python extensions.
- Differences between Visual Studio Code and the Visual Studio 2026 IDE.
- Listing Other editors (Sublime Text, Atom…) or online Python interpreters (Programiz, OnlineGDB, Replit…).
Terminal
- Using the terminal to check if Python is detected by Visual Studio Code.
- Managing typical errors (⛔ Python not found; execution policy Error)
python --version # python3 on macOS
Python Interpreter Modes

- 2 ways to run Python code: Interactive Mode and Script Mode.
Interactive Mode
>>> print("Hello, World!")
- Interactive Mode mostly used for executing commands quickly.
- Also known as the REPL (Read, Evaluate, Print, Loop).
- Shown in tutorials with 3 angle brackets (
>>>) before each Python line.
- In Visual Studio Code, use Ctrl + Shift + P and type
Python REPL. You can start the native or the terminal version.
Script mode
- Script Mode is used to write and execute entire
.py scripts with the Python interpreter.
From a single automation script to an entire project.
- I’m almost only using this mode
- This course will only use this mode as well.
print("Hello, World!")Project Organization
- Most Python projects follow a conventional structure, which heavily change based on the type of app created (web app, old-fashioned game with Panda3D, add-on in Blender, etc.).
- Libraries are working units of code you can freely integrate into your own project, while still managing the organization.
- Frameworks (in web dev, for instance) or game engines (like Panda3D) often dictate your project’s structure.
Basic Structure
- 📂 src: Source Code folder contains the main app code and keeps the core logic separated from tests, configs, and other files.
- 📂 test: The Tests folder contains scripts that verify the application continues to work as new features are added. It can be used with frameworks such as pytest or unittest.
- 📄 requirements.txt: Lists all external dependencies (libraries or frameworks) your project needs.
- 📄 README.md: Project overview & usage instructions written in Markdown.
Virtual Environment
- Creating and managing a virtual environment
python -m venv .venv # .venv is the folder's name
.venv\Scripts\activate # activate virtual environment
# .venv/bin/activate on macOS & Linux
Pip (Package installer)
pip install package_name # pip3 on macOS
pip install package_one package_two
pip list # check installed packages
Conventional Entry Point
- Overview of a conventional entry point in
main.py (why, good practices…)
- Differences between conventional entry point in Python and required entry point in some languages like C++ (
main() function).
# Conventional Entry point (main function)
def main():
print("Hello, World!")
# Main Guard
if __name__ == "__main__":
main()
3. Variables & Built-in Data Types
- Defining variables: containers used to store & manipulate data.
- Python is Dynamically typed.
- Python’s interpreter determines a variable’s type at runtime (Devs don’t need to specify it).
- Possible to reassign a value from a different data type.
- Variable type can be checked with the type() function
# Random variables
player_score = 100 # Integer (int)
player_name = "Charlotte" # String (str)
player_is_alive = True # Boolean (bool)
players = ["Max", "Alicia", "Charlotte", "Shannon"] # List (list)
# Reassigning variables
my_player_data = "Alicia"
my_player_data = 250
# Checking variable's type
print(type(player_score)) # Result will be class <int>, meaning integer
Type Hints
Since Python 3.5, you can also use type hints (see PEP 484) to specify the type of a variable using a colon (:) after the variable name.
However, this is optional and will not affect the program’s behavior. They’re simply there for clarity and for tools like linters!
boss_health: int = 100
player_coins: float = 50.0
Conventions
- Explaining the PEP-8 Style Guide (official guide for writing Python code for every Pythonista/Python programmer).
- Variable Naming conventions in programming: snake_case, camelCase, PascalCase, kebab-case, etc.
Python Conventions Overview
snake_case for variables, functions/ methods, files
_single_leading_underscore for private/internal elements
__double_leading_trailing__ for dunder (magic) methods
UPPER_SNAKE_CASE for conventional constants (no true constants in Python)
PascalCase for classes
kebab-case is not authorized in Python
camelCase is not useds in Python
None Type
The None type represents the absence of a value or a null value.
player_name = None
# Check if a variable value is None
if player_name is None:
print("Player name is not set!")
3.3. Numeric Types
Python has several numeric types, including integers (int), floating-point numbers (float), and complex numbers (complex).
player_score = 100 # int: whole numbers
player_health = 100.0 # float: decimals
player_position = 3 + 4j # complex: real + imaginary numbers (rarely used in most apps)
Integers
Integers (int) are whole numbers, positive or negative, without a decimal point. It’s useful to represent things like scores, levels, or lives in games.
Note that integers do not have a maximum value in Python, unlike other languages such as C++.
player_score = 100
bonus = 25 + 25
player_score += bonus # Now 150
player_score *= 2 # Now 300
player_score = 200 # Set directly to 200
player_magic_points = 100 + bonus
Floating-Point Numbers
Floats are numbers with decimals, useful for precision in values like health, speed, camera distance, or rotation.
player_health = 75.5
player_attack = 25.3
boss_health = 100.0
Complex Numbers
Complex numbers are real + imaginary numbers (with a j for the imaginary part). It might not be useful for most programs, but interesting for some math operations.
complex_nb = 3 + 4j
3.4. Booleans
The Boolean type (bool) is used to represent True or False values. It’s often used in conditional statements and loops.
While booleans are conceptually different from numeric types, they can be treated as integers where True is 1 and False is 0.
is_game_over = False
if is_game_over:
print("Game Over!")
3.5. Strings
Strings are sequences of characters, enclosed in single (') or double (") quotes.
You can also use triple quotes (''' or """) for multi-line strings.
player_name = "Max" # Single or double quotes
multi_line = """This is a
multi-line string."""
formatted = f"Player: {player_name}" # f-string (Python 3.6+)
4. Built-in Collections
- Python provides four main data collections:
lists, tuples, sets (plus frozensets), and dictionaries.
lists are mutable, ordered sequences that allow duplicate members
tuples are immutable, ordered, and allow duplicates
sets are unordered, unindexed, and contain no duplicates
dictionaries are mutable and ordered (as of Python 3.7+) collections of key‑value pairs without allowing duplicate keys.
Lists
- Collection of items (called elements) enclosed in square brackets
[] and separated by commas ,.
- Unlike a single value, a list can hold multiple elements of any data type, such as strings, numbers, or even other lists.
- Lists are mutable, meaning that you can change them after creation, and ordered, where each element keep an index or order..
# List creation
inventory = ["Sword", "Shield", "Potion", "Map"]
enemies = [] # Empty list
# Slicing
first_two = inventory[:2] # ["Sword", "Shield"]
last_item = inventory[-1] # "Map"
reversed_inv = inventory[::-1] # ["Map", "Potion", "Shield", "Sword"]
# Common Methods
inventory.append("Key") # Add to the end of the list
inventory.insert(1, "Bow") # Add at index 1
inventory.pop() # Remove and return the last item
Tuples
A tuple is similar to a list but immutable (cannot be changed after creation). It’s still ordered.
Tuples are useful when data should not be modified.
# Tuple creation
player_default_position = (340, 150, 70)
Set
A set is an unordered collection of unique items, not allowing duplicates. Sets are mutable.
# Set creation
unique_weapons = {"Gun", "Shotgun"}
Frozensets
A frozenset is an immutable version of a set.
# Set creation
game_description_tags = frozenset(["action", "adventure", "rpg", "open world"])
Dictionaries
A dictionary (dict) stores key-value pairs. Keys must be unique and immutable, but values can be anything.
# Creation
player = {
"name": "Alicia",
"score": 250,
"alive": True,
"inventory": ["sword", "potion"]
}
# Accessing safely by preventing KeyErrors
score = player.get("score", 0) # Returns 0 if "score" doesn't exist
# Adding/Updating
player["hp"] = 95 # Update existing
player["mana"] = 50 # Add new key
5. Control Flow
- Control flow lets your program make decisions and repeat actions.
5.1. Conditional Statements
The most classic way to make decisions in any programming language!
score = 1420
rank = ""
if score >= 5000:
rank = "Legend"
elif score >= 2500:
rank = "Master"
elif score >= 1000:
rank = "Gold"
else:
rank = "Bronze"
print(f"You are ranked: {rank}")
Remember that no parentheses are needed, unlike in other languages such as C++.
References
Articles
Basics
Data Types
Books
- Matthes, Eric. 2023. Python Crash Course. 3rd Edition. No Starch Press.
- Sweigart, Al. 2020. Beyond the Basic Stuff with Python. No Starch Press.
- Sweigart, Al. 2025. Automate the Boring Stuff with Python. 3rd Edition. No Starch Press.
In many programming languages like C or C++, the main() function is a mandatory starting point of a program, called an entry point. However, the main function in Python is optional, not mandatory, and considered a good practice.
# Function definition \ndef main(): \n pass \n \n# Function Call \n main()
Main Guard
To ensure that code only runs when the file is executed directly (and not when imported as a module), we use the main guard
if __name__ == "__main__".
This programming pattern makes your code reusable (modular) and prevents unintended execution when the file is imported elsewhere.
Comments
Comments are ignored by the Python interpreter, allowing you to add notes to your code to explain it.
Use the # symbol to write a single-line comment.
# This is a single-line comment
Docstrings or Multi-line Comments
Python doesn’t have a special multi-line comment syntax. Instead, we can use
consecutive # symbols, or write a string literal (triple quotes) that
isn’t assigned to a variable.
Triple-quoted strings are often used for docstrings, which document
functions, classes, or modules. We can use either single (‘’’) or double (“”“) triple-quotes.
'''This is a multi-line comment, \nspanning\nseveral lines!'''