Python course
The easiest language to start with: scripts, data, automation and desktop apps.
In DMarlon Studio, Python powers desktop apps (tkinter), Flask websites and the console: design the window and the studio writes the Python code.
Basic Python course
20 lessonsFrom scratch: everything you need to write your first programs.
- 1Hello, worldYour first Python program: print() writes text and results to the console. Run it with one click in DMarlon Studio.Lesson 1
- 2Variables and typesStore data in Python variables and find out their types (str, float, int and bool) with type(), using a small shop as the example.Lesson 2
- 3Numbers and arithmeticDo maths in Python: whole division with //, remainders with %, powers with ** and rounding with round(), while sharing out some pizzas.Lesson 3
- 4Strings and f-stringsWork with text in Python: join and repeat strings, count characters with len(), read positions and format values with f-strings.Lesson 4
- 5Reading from the keyboardAsk the user for data with input() in Python and convert it into numbers with int() and float() so you can do maths with it.Lesson 5
- 6Deciding with if, elif and elseMake your Python program take decisions with if, elif and else: what to wear for the weather and whether delivery is free.Lesson 6
- 7Comparisons and logicCompare values in Python with ==, !=, < and >=, and combine conditions with and, or and not to decide who rides the roller coaster.Lesson 7
- 8Repeating with whileRepeat code in Python with while as long as a condition holds: save up for a bike week by week and run a countdown.Lesson 8
- 9For loops and range()Loop over letters and numbers with for and range() in Python: a times table, Olympic years, a running total and break to stop early.Lesson 9
- 10ListsKeep several values in a Python list: read them by position, change them, loop over them with for and add them up with sum(), min() and max().Lesson 10
- 11Working with listsAdd, remove and sort the items of a Python list with append, insert, remove, pop and sort, and take parts of it with slicing [a:b].Lesson 11
- 12Tuples and unpackingUse Python tuples for data that does not change, and unpack them into several variables at once, even inside a for loop.Lesson 12
- 13DictionariesStore key-value pairs in a Python dictionary: a greengrocer's stock with get(), del, items(), keys() and values().Lesson 13
- 14SetsRemove duplicates with Python sets and compare groups with intersection, union and difference: who belongs to each school club.Lesson 14
- 15FunctionsCreate your own Python functions with def, pass them data and send results back with return, while printing a café's receipts.Lesson 15
- 16Parameters, defaults and returnGive default values to the parameters of your Python functions, call them by name and send back several results with return.Lesson 16
- 17String methodsClean up and transform text in Python with strip, split, join, lower, upper, replace, find and count, tidying a list of ingredients.Lesson 17
- 18Errors with try and exceptCatch the errors in your Python program with try and except so it keeps going: bad numbers, division by zero and missing keys.Lesson 18
- 19Writing and reading filesSave data to a text file with Python and read it back with open(), write() and read(): the high scores of a game.Lesson 19
- 20Project: grade reportA project that brings the basic Python course together: it reads marks from a file, skips bad data and prints a report with averages and grades.Lesson 20
Advanced Python course
20 lessonsFor those who know the basics: the techniques used in real projects.
- 1List, dict and set comprehensionsBuild lists, dicts and sets in a single line with Python comprehensions, including filters and unpacking. Try it in DMarlon Studio.Lesson 1
- 2*args, **kwargs and keyword-only argumentsPython functions that accept any number of arguments with *args and **kwargs, plus arguments that can only be passed by name.Lesson 2
- 3Lambdas, sorted, map and filterSort, filter and transform data in Python with lambda functions, sorted(key=...), map and filter, using a product catalogue.Lesson 3
- 4Closures and nonlocalFunctions that return functions and remember their variables: Python closures, and nonlocal to change them, with discounts and tickets.Lesson 4
- 5DecoratorsAdd logging and permission checks to Python functions without touching them: decorators, decorators with arguments and functools.wraps.Lesson 5
- 6Generators and yieldProcess a server log line by line with Python generators: yield, next(), chained generators and generator expressions.Lesson 6
- 7The iterator protocolHow a for loop works inside: iter(), next(), StopIteration, and a custom Python class with __iter__ and __next__ that pages results.Lesson 7
- 8Classes and objectsObject-oriented programming in Python: classes, __init__, self, attributes, methods, properties and __str__, with players in a role-playing game.Lesson 8
- 9Inheritance and super()Reuse and specialise Python classes with inheritance: subclasses, super(), method overriding, isinstance and the MRO, using a payroll.Lesson 9
- 10Special methodsMake your objects print, compare, add up and measure like built-in Python ones with __repr__, __eq__, __lt__, __add__ and __len__.Lesson 10
- 11DataclassesPython dataclasses with @dataclass: free __init__, __repr__ and __eq__, field(default_factory), __post_init__, frozen and order.Lesson 11
- 12Enums and match/caseOrder states with Enum and events handled with match/case in Python: value, mapping and sequence patterns, captures and guards.Lesson 12
- 13Custom exceptions and context managersCreate your own exceptions and context managers in Python: with, __enter__, __exit__, contextlib.contextmanager and suppress, in a warehouse.Lesson 13
- 14Type hints, protocols and genericsPython type hints: aliases with type, typing.Protocol for structural typing and generic functions with the Python 3.12 syntax.Lesson 14
- 15Counter, defaultdict, deque and namedtupleThe data structures in Python's collections module: Counter, defaultdict, deque and namedtuple, applied to the sales of a coffee shop.Lesson 15
- 16itertools and functoolsHandy tools from Python's standard library: accumulate, combinations, chain, count, islice and groupby, plus lru_cache, reduce and partial.Lesson 16
- 17Recursion and memoizationRecursive Python functions to walk a folder tree, and memoization with a dictionary to count the ways to pay an amount.Lesson 17
- 18JSON and regular expressionsRead and write JSON with Python's json module and pull data out of a log with regular expressions: named groups, findall and sub.Lesson 18
- 19asyncio with async and awaitAsynchronous Python with asyncio: coroutines with async and await, gather to run tasks together, sleep(0) and wait_for with a timeout.Lesson 19
- 20Project: a tested inventoryA small Python inventory that brings together classes, dataclasses and custom exceptions, checked with assert tests. Run it in DMarlon Studio.Lesson 20