Marsof Academy
Course 1 · Unit 2

Engineering with Python

Part of Foundations: programming and data

  • 16 lessons
  • ≈ 54 h of study
  • Level: beginner

Python as an engineering tool, from variables, lists and dictionaries to classes, generators, decorators and testing, with an optional final block on profiling and concurrency.

Topics covered

  • Variables
  • Types
  • Conditionals
  • Loops
  • Functions
  • Modules
  • Packages
  • Exceptions
  • Files
  • OOP
  • Classes
  • Inheritance
  • Decorators
  • Generators
  • Iterators
  • Context managers
  • Typing
  • Async
  • Concurrency
  • Testing
  • Profiling

Lessons in this unit

  1. Variables, types and expressions 60 min
    The building blocks of every Python program — names, values, types and the basic operations between them.
  2. Operators, formatting and precision 75 min
    The finer details of numbers in Python — the order in which things are calculated, floor division and remainder, how to show results with just the right format and why floats aren't exact.
  3. Conditionals and loops 70 min
    How a program decides what to do and repeats work — if, for, while, break and continue.
  4. Functions 80 min
    Packaging logic with a name, inputs and an output — and treating functions as values.
  5. Lists and tuples 95 min
    Storing many values in order and working with them — the structure you'll handle data with every day.
  6. Dictionaries and sets 80 min
    Looking things up by name, counting and accumulating with dictionaries, and removing duplicates or comparing collections with sets.
  7. Comprehensions and the collections module 80 min
    Transforming and filtering collections in one readable line, and counting and grouping with Counter and defaultdict.
  8. Exceptions and error handling 80 min
    When something goes wrong, fail clearly or recover on purpose — never silently.
  9. Files, CSV and JSON 75 min
    Reading and writing the formats where the datasets, configurations and results of any AI project live.
  10. Classes and objects 65 min
    Bringing data and the code that handles it together in a single object with state — the shape of a model, a tokeniser or an optimiser.
  11. Inheritance, composition and special methods 90 min
    Reuse and specialise classes with inheritance and super(), combine objects with composition and make your classes behave like built-in types.
  12. Iterators and generators 90 min
    Producing data on demand, one item at a time, to work with datasets that don't fit in memory.
  13. Decorators and context managers 90 min
    Adding behaviour to functions without touching them (timing, caching, retrying) and guaranteeing resource cleanup with with.
  14. Types, dataclasses and tests 75 min
    Document contracts with type annotations, model data with dataclasses and prove that your code works with automated tests.
  15. Advanced Python (optional): measure before you optimise 90 min · optional
    Timing code properly, finding where the time really goes with a profiler and checking how the cost grows as the data grows.
  16. Advanced Python (optional): concurrency and async 100 min · optional
    Doing several things at once with threads, processes and asyncio, and knowing which to choose depending on whether your program computes or waits.

Prerequisites

Before this unit it helps to have done:

The full explanations, auto-graded exercises, exams and projects are inside the academy.

Every lesson you complete gives you 10 yang, the academy's currency, and every unit exam you pass, 50.

Shall we start?

Create your account and activate your subscription: you get the whole syllabus from day one.