Skip to content

Koech009/Module-4-assignment-Functions-Modules-and-Libraries-in-Python

Repository files navigation

Module 4 – Python Functions, Modules, and Libraries

A beginner-friendly Python project demonstrating the use of functions, modules, and third-party libraries using Python 3 and VS Code.


📌 Overview

This repository contains the final submission for Module 4 of the Python Programming course.
The project focuses on writing reusable functions, organizing code into modules, and using external Python libraries.


✅ Tasks Covered

🔹 Task 1: Functions

  • Created functions that accept parameters and return results
  • Used docstrings to document functions
  • Implemented default arguments and keyword arguments
  • Performed mathematical operations such as:
    • Addition
    • Subtraction
    • Multiplication
    • Division
    • Power

📁 Relevant files:

  • functions.py
  • basic_operations.py
  • math_operations.py

🔹 Task 2: Modules

  • Organized code into multiple Python modules
  • Created separate files for different operations:
    • addition.py
    • multiplication.py
  • Imported custom modules into a main script
  • Demonstrated modular and reusable code structure

📁 Relevant files:

  • addition.py
  • multiplication.py
  • main.py
  • main_challenge.py

Why modules are important:

  • Improve code readability
  • Make code reusable
  • Simplify maintenance
  • Allow teamwork and scalability

🔹 Task 3: Libraries

  • Explored third-party Python libraries
  • Used the requests library to fetch data from a public API
  • Used the matplotlib library to visualize data using graphs

📁 Relevant files:

  • fetch_data.py
  • plot_graph.py

📊 Example Visualization

The plot_graph.py script plots student marks using matplotlib to demonstrate basic data visualization.


🛠 Requirements

  • Python 3.x
  • VS Code
  • Required libraries:
    pip install requests matplotlib

▶️ How to Run

Run any script using:

python3 filename.py

Example:

python3 main.py python3 plot_graph.py

📁 Project Structure class-work/ │ ├── addition.py ├── multiplication.py ├── functions.py ├── basic_operations.py ├── math_operations.py ├── fetch_data.py ├── plot_graph.py ├── main.py ├── main_challenge.py ├── README.md └── pycache/

👨‍🎓 Author

Ian Module 4 – Python Programming

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages