Python Library to draw with percentage
Project description
Draw with percentages
Python library for randomizing given elements with the appropriate percentage chance.
Example:
Sample library usage
Code:
from draw_with_percentage import draw_with_percentage
percentages = [
["option1", "10"],
["option2", "20"],
["option3", "30"],
["option4", "40"]
]
res = draw_with_percentage(percentages)
Response:
- Option 1 10% chance will be refunded.
- Option 2 20% chance will be refunded.
- Option 3 30% chance will be refunded.
- Option 4 40% chance will be refunded.
Request:
[
["name", "percent"],
["name", "percent"],
["name", "percent"],
["name", "percent"]
// etc.
]
Remember:
- In the first field we give the name of the element.
- In the second field we give the percentage written as a string.
- We write the percentage down to three places after the decimal point.
- The sum of all percentages must be 100.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file draw with percentage-0.0.6.tar.gz.
File metadata
- Download URL: draw with percentage-0.0.6.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edb630ad956e71c18d7870935ea2d0f4a0174a24cc80fd13f2e39f5a8a0fe8fb
|
|
| MD5 |
43ff407bcfcdd676a92a6c83ff987978
|
|
| BLAKE2b-256 |
1c703e888cda98240ff94e38b0bbd9cbc069cbe492965e63cab6740efd27f50e
|
File details
Details for the file draw_with_percentage-0.0.6-py3-none-any.whl.
File metadata
- Download URL: draw_with_percentage-0.0.6-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e49ed8493d1c595152b3fb1a8ee6b11f65a51338a69291b4d4bb27f418c203
|
|
| MD5 |
1d6164de8074b741ae4b17e7fa9860a2
|
|
| BLAKE2b-256 |
612465db426d089860489ead7f922201125f7832c92e4b3c5f05e2548b938edb
|