Welcome to python-functions-and-modules, part of the practice-python-for-beginners series.
This repository helps learners understand how to write and use Python functions and organize reusable code into modules.
- Defining and calling functions
- Function arguments (
positional,keyword,default,*args,**kwargs) - Return values
- Importing modules (
import,from ... import) - Using built-in and custom modules
Purpose:
Teach learners about defining and calling functions, passing arguments, returning values, using built-in and custom modules, and writing modular, reusable Python code.
python-functions-and-modules/
β
βββ LICENSE
βββ README.md
β
βββ exercises/
β βββ defining_functions.py
β βββ arguments_and_returns.py
β βββ custom_module_example.py
β βββ importing_modules.py
β βββ tests/
β βββ test_defining_functions.py
β βββ test_arguments_and_returns.py
β βββ test_importing_modules.py
β
βββ requirements.txt
-
Clone this repository:
git clone https://github.com/practice-python-for-beginners/python-functions-and-modules.git cd python-functions-and-modules -
Create and activate a virtual environment (optional):
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run tests to validate your understanding:
pytest
By working through these exercises, you will learn:
- How to define and call Python functions
- Importance of parameters and return values
- How to import and use standard and user-defined modules
- How modular Python code improves readability and reusability
This codebase is licensed under the GNU General Public License v3 (GPLv3).
See LICENSE for details.