pyfractions


Namepyfractions JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/coderatul/fraction
SummaryA Python library for working with fractions
upload_time2024-03-02 21:53:03
maintainer
docs_urlNone
authorAtul kushwaha
requires_python
licenseMIT
keywords fraction math
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```python
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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/coderatul/fraction",
    "name": "pyfractions",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "fraction math",
    "author": "Atul kushwaha",
    "author_email": "atulkushwaha2008@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d9/82/2608da8abef49517b1a8214f37b0b43a8d0bb92a6270b795152e622e8bf7/pyfractions-0.1.0.tar.gz",
    "platform": null,
    "description": "# Fraction Calculator\r\n\r\nThe 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.\r\n\r\n## Features\r\n\r\n- **Basic Arithmetic Operations:**\r\n  - Addition\r\n  - Subtraction\r\n  - Multiplication\r\n  - Division\r\n  - Floor Division\r\n  - Modulus\r\n\r\n- **Comparison Methods:**\r\n  - Compare fractions using the following methods:\r\n    - Less than (`<`)\r\n    - Less than or equal to (`<=`)\r\n    - Equal to (`==`)\r\n    - Not equal to (`!=`)\r\n    - Greater than (`>`)\r\n    - Greater than or equal to (`>=`)\r\n\r\n## Usage\r\n\r\nTo utilize the Fraction Calculator, create instances of the `Fraction` class and perform operations. Here's an example showcasing basic usage:\r\n\r\n```python\r\nfrom pyfractions import Fraction\r\n\r\n# Create Fraction objects\r\nfraction1 = Fraction(1, 2)\r\nfraction2 = Fraction(3, 4)\r\n\r\n# Perform operations\r\nsum_result = fraction1 + fraction2\r\ndifference_result = fraction1 - fraction2\r\nproduct_result = fraction1 * fraction2\r\nquotient_result = fraction1 / fraction2\r\n\r\n# Display results\r\nprint(f'Sum: {sum_result}')               # Sum: 5/4\r\nprint(f'Difference: {difference_result}') # Difference: -1/4\r\nprint(f'Product: {product_result}')       # Product: 3/8\r\nprint(f'Quotient: {quotient_result}')     # Quotient: 2/3\r\n\r\n# Check if fraction1 is greater than fraction2\r\nis_greater = fraction1 > fraction2\r\n\r\n# Display result\r\nprint(f'Is fraction1 greater than fraction2? {is_greater}') \r\n# Is fraction1 greater than fraction2? False\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python library for working with fractions",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/coderatul/fraction",
        "Source": "https://github.com/coderatul/fraction",
        "Tracker": "https://github.com/coderatul/fraction/issues"
    },
    "split_keywords": [
        "fraction",
        "math"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a65c042798c655b24035395d3e16334b308351f57a6ddacd1694545e081a26a9",
                "md5": "1a9e92824ca9fa3cdfbe78412cd7d9ac",
                "sha256": "e5d07acf25ca0f60726292b3ae24f040d426a3c24312c8b83e17b746ce9de4e6"
            },
            "downloads": -1,
            "filename": "pyfractions-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a9e92824ca9fa3cdfbe78412cd7d9ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4470,
            "upload_time": "2024-03-02T21:53:00",
            "upload_time_iso_8601": "2024-03-02T21:53:00.986538Z",
            "url": "https://files.pythonhosted.org/packages/a6/5c/042798c655b24035395d3e16334b308351f57a6ddacd1694545e081a26a9/pyfractions-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9822608da8abef49517b1a8214f37b0b43a8d0bb92a6270b795152e622e8bf7",
                "md5": "0ef540fae79b45ffaf2d319028d23ba2",
                "sha256": "0cf9deaadad46920ca8788e74c886fb226b5a6e12f6edaef9a33e58fc063161f"
            },
            "downloads": -1,
            "filename": "pyfractions-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0ef540fae79b45ffaf2d319028d23ba2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4122,
            "upload_time": "2024-03-02T21:53:03",
            "upload_time_iso_8601": "2024-03-02T21:53:03.166334Z",
            "url": "https://files.pythonhosted.org/packages/d9/82/2608da8abef49517b1a8214f37b0b43a8d0bb92a6270b795152e622e8bf7/pyfractions-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-02 21:53:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "coderatul",
    "github_project": "fraction",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyfractions"
}
        
Elapsed time: 0.21242s