Python Functions Explained
Learn what Python functions are, why they matter for organizing code, and how they form the foundation of non-trivial programs.
Learn Python programming from scratch
Learn what Python functions are, why they matter for organizing code, and how they form the foundation of non-trivial programs.
Learn the exact syntax for defining and calling Python functions with the def keyword, including naming rules, the function body, and how the call stack works.
Learn the difference between parameters and arguments, how to pass values by position and by keyword, and the rules for default parameter values.
Learn how Python functions send results back with the return statement, how to return multiple values, and the difference between returning and printing.
Understand Python's LEGB scope rules: local, enclosing, global, and built-in. Learn where variables are visible and why functions isolate their local state.
Learn how **kwargs lets Python functions accept any number of keyword arguments, how it works as a dictionary, and how to combine it with *args for maximum flexibility.
Learn how lambda functions work in Python, when to use them for short anonymous operations, and when a regular named function is the better choice.
Learn what Python modules and packages are, how they organize code beyond single scripts, and why they matter for building maintainable programs.
Learn how to read and write large files in Python without running out of memory, using chunked reading, line-by-line iteration, and buffered writes.
Learn what object-oriented programming means in Python, why classes and objects matter, and how OOP helps you organize larger programs into manageable, reusable pieces.
Learn how to overload Python operators using magic methods, from arithmetic and comparison to string representation, so your custom classes work naturally with built-in syntax.
Learn the best practices for designing Python classes, from the SOLID principles adapted for Python to practical guidelines for writing maintainable object-oriented code.