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.
- Introduction
- Features
- Programming Paradigms
- Getting Started
- Usage
- Contributing
- License
- Releases
- Contact
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.
- 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
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 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 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.
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 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.
To get started with the Python Calculator Paradigms, follow these steps:
-
Clone the repository:
git clone https://github.com/Farel17-Nuzhan/python-calculator-paradigms.git cd python-calculator-paradigms
-
Install dependencies: Make sure you have Python installed. You can use pip to install any necessary packages.
-
Run the calculator: Navigate to the desired implementation and run the corresponding Python file.
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.
Here’s how you can run a simple OOP calculator:
python oop_calculator.py
Follow the prompts to perform calculations.
We welcome contributions! If you would like to add a new calculator implementation or improve existing ones, please follow these steps:
- Fork the repository.
- Create a new branch for your feature:
git checkout -b feature-name
- Make your changes and commit them:
git commit -m "Add new feature"
- Push to your branch:
git push origin feature-name
- Create a pull request.
Please ensure your code adheres to the existing style and includes comments where necessary.
This project is licensed under the MIT License. See the LICENSE file for details.
You can find the latest releases and download the files from the Releases section. Each release contains the necessary files to run the calculators.
For questions or suggestions, feel free to reach out:
- Email: [email protected]
- GitHub: Farel17-Nuzhan
Thank you for exploring the Python Calculator Paradigms! We hope you find this repository helpful in your learning journey.