Go deeper into Python functions: arguments, scope, lambdas, decorators, generators, and modules.
You can already write a function. This is the course about what happens when other code starts calling it. A function that returns instead of prints can be used; one that prints can only be watched. A function that takes options can serve six call sites instead of one. A function that hands back a function can be configured once and reused everywhere. That last idea is the hinge. Once a function is a value you can pass around, decorators stop being magic syntax and become one assignment written shorter, and three later courses stop being mysterious: a Flask route is a decorated function, a pytest fixture is a decorated function, and a property is a decorated method. This course also covers producing values one at a time instead of building a list, solving problems whose depth you do not know in advance, and splitting a program across files that find each other. Everything is built on Gridwatch, a household energy-meter toolkit that grows through the course: a reading formatter, a report that takes options, a tariff resolver that reads settings from three places, a sortable report, timing and caching wrapped around the slow lookups, a reading stream that never builds a list, totals across a nested site tree, the whole thing split into a module, and finally the toolkit itself. By the end you are writing a library other code calls, rather than a script that runs once.
45 Lessons • 53 Practices • 18 Quizzes • 4 Projects · ~10h Total
Not just theory. You finish this course with real work to show.
This is the same in-browser editor every lesson uses. Edit the code, hit Run.
Run code in the browser and see the result immediately. Every lesson works this way.
Stuck? Puff explains the error and nudges you forward, without giving the answer away.
Streaks, diamonds, and certificates. Your progress saves automatically, forever.
Every completed course issues a certificate with a public verification link.
Every certificate has a public verification link employers can check.
One certificate per course. Finish a program and earn its program certificate too.
LinkedIn-ready, with a PDF you can download and attach.
Your files are getting long and everything is one script. This is how code starts having parts.
You use decorators every day and have never written one. By section 5 you will have written six.
Every route and every fixture is a decorated function. This is the only course that teaches that.
Python Functions is free to start, no credit card needed. Some later sections are part of Pro, and finishing every section, including the certificate, needs a Pro plan.
Yes. This one assumes you can write a function with parameters and a return, and that a list of dictionaries is ordinary to you. Both come from Python Basics and Python Data Structures, and this course spends them from item one.
Adding the same behaviour to many functions without editing any of them: timing them, caching their answers, checking permissions before they run, registering them somewhere. A decorator is a function that takes a function and hands back a replacement, and the at sign is shorthand for one assignment. This course writes one by hand before ever showing the syntax.
When you do not need all the values at once. A list computes and stores everything before you touch any of it; a generator hands back one value at a time and holds only that one, which matters when the sequence is long, expensive, or does not end. The trade is that a generator can be walked once.
The editor holds one file, so the module beside it is written to the browser's in-memory filesystem at the top of the exercise, under a marked block. Everything after that is real: a real file, found by the real import machinery, and the `import` line you write is exactly what you would write on your own machine.
Gridwatch, an energy-meter toolkit: a formatter, a configurable report, a tariff resolver, timing and caching decorators, a reading stream, a recursive site total, and finally the whole thing as an importable module with four projects along the way.
Yes, for this course at 100 percent. It also counts towards the Python Developer program certificate, which issues once every course in that program is complete.
How this course connects to the bigger picture, and what to explore next.
Write object-oriented Python: classes, inheritance, properties, special methods, and dataclasses.
Model real data with Python lists, tuples, dictionaries, sets, and comprehensions.
Write real Python in your browser: variables, strings, conditionals, loops, lists, and functions.
Free to start, no credit card required. Write real code from the first lesson and keep your progress forever.
Start Learning Free