A slide deck covering Python function definitions, parameters, arguments, return values, list/dict/set comprehensions, and functional programming patterns, used by instructors to deliver lectures and by learners as a reference for writing reusable and expressive Python code.
Topics
This module covers 7 topics. Open a topic to see its subtopics.
Module Content
17 items.
-
-
A reading page covering Python's variable-length argument mechanisms (*args and **kwargs), explaining how they collect positional and keyword arguments to build flexible, reusable functions; learners read through the explanations and examples to understand how to apply these patterns in their own code.
-
A reading that introduces Python's def statement, covering function naming, parameter lists, indented bodies, and return values (including the implicit None when return is omitted), which learners study to begin writing and reusing their own functions.
-
A lesson distinguishing parameters in a def line from the arguments passed at call time, then expanding into the various ways arguments can be supplied, used by learners to read error messages and documentation more confidently and to call functions correctly.
-
A reading on variable scope that explains the LEGB name-resolution order — Local, Enclosing, Global, and Built-in — so learners can predict which value a given name refers to and avoid common scope-related bugs.
-
A topic page on recursion that defines self-calling functions through examples like factorial and Fibonacci and stresses the need for both a base case and a recursive case, used by learners to recognise and write correct recursive solutions.
-
A reading on comprehensions that shows how to replace the empty-list-plus-append-loop pattern with a single-line expression combining an output expression, a for clause, and an optional filter, across the collection types Python supports.
-
A lesson on the lambda keyword for creating small anonymous single-expression functions and the functional programming patterns that use them, which learners apply where a short throwaway function is needed instead of a named def.
-
A consolidated single-page version of the full module that strings together all the topic readings — defining functions, parameters and arguments, scope, recursion, comprehensions, and lambda/functional patterns — useful for continuous reading, printing, or review before an assessment.
-
An interactive reading page introducing Python function definitions using the def and return statements along with docstrings, used by learners to understand how to write, call, and document reusable functions.
-
A reading page covering Python's variable-length argument mechanisms (*args and **kwargs), explaining how they collect positional and keyword arguments to build flexible, reusable functions; learners read through the explanations and examples to understand how to apply these patterns in their own code.
-
A reference text covering advanced Python function concepts—including variable-length arguments (*args and **kwargs), list/dict/set comprehensions, and functional programming patterns like decorators and middleware—which learners read to understand how to write flexible, reusable functions and instructors can assign as a study resource or lecture supplement.
-
An interactive reading page covering Python's LEGB scope rule and the global and nonlocal keywords, used by learners to understand how variable names are resolved across local, enclosing, global, and built-in scopes.
-
An interactive reading page covering Python's LEGB scope rule and the global and nonlocal keywords, used by learners to understand how variable names are resolved across local, enclosing, global, and built-in scopes.
-
An assignment page directing students to write a Python while-loop program that evaluates multiple equipment purchase scenarios by calculating Present Value of resale and revenue streams over a 10-year lifespan at 5% interest, used by learners to apply engineering economics concepts in code.
-
A 35-question quiz bank testing learners on Python function syntax (def keyword, return statements, docstrings, default and keyword arguments) and related functional programming concepts, used by instructors to build assessments or by learners to self-test their understanding of the module.
-
A ten-round interactive quiz presenting hidden blocks from Python recursive functions and asking learners to classify each block as either a base case or a recursive case, used to reinforce understanding of recursion structure.