Skip to content

Module 1 - Foundations of Python Coding

This module introduces the essential concepts of Python programming and the foundational practices needed for scientific software development. Participants learn how to set up a working environment, write clear Python code, use notebooks and scripts, process data, and organize small projects in a way that can grow later.

Learning outcomes

By the end of this module, participants will be able to:

  • Set up a working Python environment using Miniforge3 and VS Code.
  • Understand and use Python syntax, data structures, and control flow.
  • Write and execute simple scripts and notebooks.
  • Use core scientific libraries such as NumPy, pandas, and matplotlib.
  • Follow basic best practices for readability, reproducibility, and structure.
  • Apply introductory object-oriented programming concepts.
  • Manage dependencies in virtual environments with conda, venv, and pip.

Study pages

Use the pages linked below as the student-facing handbook for this module:

Sections and timing

  1. Quick welcoming to the course and module (15min)
  2. Setting up the Python and Development Environment (1h-1h15min)
    • Installing VS Code, Python via Miniforge3, and checking GitHub accounts
    • Configuring VS Code for Python development
    • Creating and managing virtual environments (conda, venv)
    • Jupyter Notebook introduction
    • (Optional) Quiz
  3. Introduction to Python (45min)
    • What is Python?
    • The interactive Python terminal
    • Variables and naming conventions
    • Basic data types: string, integer, float, boolean, complex
    • Expressions and operators
    • (Optional) Quiz
  4. Core syntax and control flow (1h30min)
    • Functions
    • Conditional statements (if / elif / else)
    • Data structures: lists, tuples, dictionaries, sets
    • Iteration (for and while loops)
    • List comprehensions
    • Recursion
    • Error and exception handling
    • (Optional) Quiz
  5. Working with Files and Data (1h30min)
    • Basic input/output (I/O) file operations: text, CSV, and JSON
    • Numerical arrays and vectorized operations (numpy)
    • Visualizing data (matplotlib)
    • Structured data handling (pandas)
    • Managing file paths (os, pathlib)
    • (Optional) Numerical methods in Python (scipy)
    • (Optional) Quiz
  6. Code Quality (45min)
    • Reproducible research code
    • Python style conventions (PEP 8)
    • Writing clear docstrings and comments
    • Introduction to Python typing and style checks (mypy, ruff)
    • Basic logging and informative error messages
    • Introduction to testing
    • (Optional) Quiz
  7. Introduction to Object-Oriented Programming (OOP) (1h30min)
    • Classes, attributes, and methods
    • Abstraction
    • Naming conventions and design
    • SOLID principles vs. functional programming
    • (Optional) Quiz
  8. Teaser to Project Organization (30min)
    • Recommended folder structure
    • Introduction to templates
    • Naming and modularization
    • (Optional) Quiz

Participants' projects

After the last session, we will organize an additional 2-hour session for all participants. The goal is to give everyone uninterrupted time to work on their own projects with support from experts and peers.