Skip to content

Explore various calculator implementations in Python, showcasing OOP, functional programming, and more. Each file demonstrates key concepts through practical examples, making it easy to learn and apply Python skills. 🐙💻

License

Notifications You must be signed in to change notification settings

Farel17-Nuzhan/python-calculator-paradigms

Repository files navigation

Python Calculator Paradigms 🧮

Python Calculator Paradigms

Welcome to the Python Calculator Paradigms repository! This collection showcases various implementations of calculators in Python, utilizing different programming paradigms. Whether you are a beginner or an experienced developer, you will find practical examples that help you explore core Python concepts.

Table of Contents

Introduction

This repository serves as a hands-on guide to understanding Python through calculator implementations. Each implementation demonstrates a different programming paradigm, allowing you to see how the same problem can be solved in various ways. This approach deepens your understanding of Python and enhances your coding skills.

Features

  • Implementations of calculators using:
    • Object-Oriented Programming (OOP)
    • Functional Programming
    • Decorators
    • Match-case
    • Recursion
  • Educational examples that illustrate core Python concepts
  • Exception handling to manage errors effectively
  • Getter and setter methods for encapsulation
  • CLI tools for easy interaction

Programming Paradigms

Object-Oriented Programming (OOP)

In OOP, we encapsulate data and behavior within classes. This paradigm helps in organizing code and making it reusable. You will find examples of calculators that leverage classes and objects to manage state and behavior.

Functional Programming

Functional programming emphasizes functions as first-class citizens. This approach avoids changing state and mutable data. The calculator implementations in this section showcase how to create calculators using pure functions and higher-order functions.

Decorators

Decorators provide a way to modify the behavior of functions or methods. You will see how to use decorators to enhance calculator functionalities, such as logging operations or validating inputs.

Match-case

Introduced in Python 3.10, the match-case statement offers a clean way to handle complex conditional logic. The examples in this repository demonstrate how to use match-case to create more readable and maintainable code.

Recursion

Recursion involves a function calling itself to solve a problem. You will find examples of calculators that utilize recursion for tasks like evaluating expressions or calculating factorials.

Getting Started

To get started with the Python Calculator Paradigms, follow these steps:

  1. Clone the repository:

    git clone https://github.com/Farel17-Nuzhan/python-calculator-paradigms.git
    cd python-calculator-paradigms
  2. Install dependencies: Make sure you have Python installed. You can use pip to install any necessary packages.

  3. Run the calculator: Navigate to the desired implementation and run the corresponding Python file.

Usage

Each calculator implementation is located in its respective folder. You can explore the code and run the calculators directly. The README files within each folder provide specific instructions on how to use that implementation.

Example Usage

Here’s how you can run a simple OOP calculator:

python oop_calculator.py

Follow the prompts to perform calculations.

Contributing

We welcome contributions! If you would like to add a new calculator implementation or improve existing ones, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature:
    git checkout -b feature-name
  3. Make your changes and commit them:
    git commit -m "Add new feature"
  4. Push to your branch:
    git push origin feature-name
  5. Create a pull request.

Please ensure your code adheres to the existing style and includes comments where necessary.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

You can find the latest releases and download the files from the Releases section. Each release contains the necessary files to run the calculators.

Contact

For questions or suggestions, feel free to reach out:

Thank you for exploring the Python Calculator Paradigms! We hope you find this repository helpful in your learning journey.

About

Explore various calculator implementations in Python, showcasing OOP, functional programming, and more. Each file demonstrates key concepts through practical examples, making it easy to learn and apply Python skills. 🐙💻

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages