Skip to content

RaghavRD/Fraction-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fraction Calculator

Fraction Calculator is a Python project designed to perform mathematical calculations on fractions. It allows users to perform addition, subtraction, multiplication, and division operations on fractions, providing results in fractional form. The project utilizes magic methods in Python for enhanced functionality and ease of use.

Key Features

  • Perform addition, subtraction, multiplication, and division operations on fractions.
  • Display results in fractional form (e.g., 1/2) for better readability.
  • Utilize Python's magic methods to enable natural and seamless operations on fractions.
  • Easily integrate the Fraction Calculator into existing Python projects for fraction-related calculations.

Technologies Used

  • Python 3: Latest version of the Python, python 3 is used to build the application.

Screenshots

Preview 1
Preview 2
Preview 3\

Installation

  • Clone the repository: git clone https://github.com/your-username/fraction-project.git

  • Change into the project directory: cd fraction

  • Install dependencies (if any): pip install -r requirements.txt

  • Run the project

Usage

  • Import the Fraction class from fraction.py: from fraction import Fraction

  • Create fractions:
    frac1 = Fraction(1, 2)
    frac2 = Fraction(1, 4)

  • Perform operations:

Addition

result_addition = frac1 + frac2
print("Addition:", result_addition) # Output: 3/4

Subtraction

result_subtraction = frac1 - frac2
print("Subtraction:", result_subtraction) # Output: 1/4

Multiplication

result_multiplication = frac1 * frac2
print("Multiplication:", result_multiplication) # Output: 1/8

Division

result_division = frac1 / frac2
print("Division:", result_division) # Output: 2/1 (integer division)

Lessons Learned

  • Implementing mathematical operations on custom data types
  • Using magic methods for operator overloading
  • Enhancing user experience with intuitive design

Acknowledgements

  • Inspired by the need for a simple and intuitive fraction calculator in Python.
  • Built with love and dedication to the Python programming community.

License

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

About

The Fraction project is a Python application that facilitates mathematical calculations on fraction data, providing results in fractional format. It uses magic methods to enable operations like addition, subtraction, multiplication, and division on fractions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages