Skip to main content

Fraction Calculator

The Fraction Calculator is a versatile Python library designed for performing various operations in numerator/denominator format. It enables users to work with fractions seamlessly and includes features like basic arithmetic operations, comparison methods, and more.

Features

  • Basic Arithmetic Operations:

    • Addition
    • Subtraction
    • Multiplication
    • Division
    • Floor Division
    • Modulus
  • Comparison Methods:

    • Compare fractions using the following methods:
      • Less than (<)
      • Less than or equal to (<=)
      • Equal to (==)
      • Not equal to (!=)
      • Greater than (>)
      • Greater than or equal to (>=)

Usage

To utilize the Fraction Calculator, create instances of the Fraction class and perform operations. Here's an example showcasing basic usage:

from pyfractions import Fraction

# Create Fraction objects
fraction1 = Fraction(1, 2)
fraction2 = Fraction(3, 4)

# Perform operations
sum_result = fraction1 + fraction2
difference_result = fraction1 - fraction2
product_result = fraction1 * fraction2
quotient_result = fraction1 / fraction2

# Display results
print(f'Sum: {sum_result}')               # Sum: 5/4
print(f'Difference: {difference_result}') # Difference: -1/4
print(f'Product: {product_result}')       # Product: 3/8
print(f'Quotient: {quotient_result}')     # Quotient: 2/3

# Check if fraction1 is greater than fraction2
is_greater = fraction1 > fraction2

# Display result
print(f'Is fraction1 greater than fraction2? {is_greater}') 
# Is fraction1 greater than fraction2? False

Metadata

Release files for pyfractions 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfractions 0.1.0
File Size Uploaded Provenance Actions
pyfractions-0.1.0.tar.gz 4.1 kB Without provenance Details for pyfractions-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyfractions 0.1.0
File Interpreter ABI Platform Actions
pyfractions-0.1.0-py3-none-any.whl Python 3 none any Details for pyfractions-0.1.0-py3-none-any.whl

Total release size: 8.6 kB

Release files / pyfractions-0.1.0.tar.gz

Download URL pyfractions-0.1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0cf9deaadad46920ca8788e74c886fb226b5a6e12f6edaef9a33e58fc063161f
BLAKE2b-256 checksum
How to use checksums
d9822608da8abef49517b1a8214f37b0b43a8d0bb92a6270b795152e622e8bf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.3

Release files / pyfractions-0.1.0-py3-none-any.whl

Download URL pyfractions-0.1.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5d07acf25ca0f60726292b3ae24f040d426a3c24312c8b83e17b746ce9de4e6
BLAKE2b-256 checksum
How to use checksums
a65c042798c655b24035395d3e16334b308351f57a6ddacd1694545e081a26a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.3

Security for pyfractions 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page