Skip to main content

A comprehensive codebase to calculate percentages.

Project description

Percent: A Python Package for Percentage Calculation

Inspired by the brilliant and complex project is-thirteen, I embarked on the arduous journey of creating this project. Without that monumental inspiration, I likely would have chosen an easier path in life.

Description

The percent package is designed to calculate the percentage of a given part based on a whole. With rigorous validation mechanisms and exception handling, this package ensures accurate calculations while raising meaningful errors for invalid input. Given its complexity, this project is ongoing, and your contributions are not just welcomed; they're critically needed.

Installation

You can install the package using pip:

pip install ez-percent

Usage

Here's how to make the most out of the percent package:

1. Basic Calculation

Calculate the percentage of a part relative to a whole with ease:

from percent import percent

result = percent(25, 100)
print(result)  # Output: 25.0

2. Handling Zero Division

Attempt to calculate a percentage with a whole of zero, which will trigger an appropriate error:

try:
    percent(7, 0)
except ValueError as e:
    print(e)  # Output: Whole cannot be zero. Division by zero is undefined.

3. Type Validation

Input validation ensures only valid numeric types are processed. Here's how it will respond to invalid inputs:

try:
    percent("25", 100)
except TypeError as e:
    print(e)  # Output: Both 'part' and 'whole' must be numbers (int or float).

Contributions Needed

This project is incredibly challenging and requires additional contributors who are brave enough (or foolish enough) to help unearth the complexities involved. If you have what it takes to tackle the mathematical intricacies of percentage calculations, we’d love your support!

Please fork the repository and submit pull requests for any enhancements or bug fixes.

License

This project is licensed under the Mozilla Public License Version 2.0.

While I am genuinely grateful to all the contributors who have aided in this endeavor, I cannot overlook the significant hardships I endured to publish the first version of this package. Therefore, I am disallowing unauthorized redistribution and imposing additional limitations on the use of this project.

See the LICENSE for more details.


Future Enhancements

While the current implementation serves its purpose, there are numerous avenues for improvement that can make this package even more robust and user-friendly. Some ideas include:

  • Support for Percent Ranges: Allow users to calculate percentages for a range of values, making bulk processing easier.
  • Enhanced Error Handling: Provide more detailed error messages for various numeric types and edge cases.
  • Unit Tests: Develop comprehensive unit tests to ensure the reliability of calculations.
  • Documentation: Expand documentation with more examples and detailed explanations to aid users of all skill levels.

Acknowledgments

Shout out to all who have embarked on this journey with me! Collectively, we can navigate the tricky waters of percentage calculations and tackle the complexities that lie ahead.

Contact

For any inquiries or suggestions, feel free to reach out. Collaboration is key, and I'm always open to feedback!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ez_percent-0.0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ez_percent-0.0.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file ez_percent-0.0.1.tar.gz.

File metadata

  • Download URL: ez_percent-0.0.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ez_percent-0.0.1.tar.gz
Algorithm Hash digest
SHA256 96c987d1d06f1c62b0163dfdd2e69e93921406fbf33847b489674bac0c066c4b
MD5 d7ed0ddd9825fb16a81c37f2bfb9cd49
BLAKE2b-256 068fa7a461bcf06dc8f36a6223ae224ff8c775677c9a189670588a40c8d57627

See more details on using hashes here.

File details

Details for the file ez_percent-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ez_percent-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ez_percent-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ecfb1c19cbde7da80804e613b4fab793486d8932e77a31cc1252da269f25a25
MD5 116f22db39976117e926899fbc7a0983
BLAKE2b-256 31b4f604ef3a311150acc565515a530220e6b3f1003c67b64055c714f3d2a782

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page