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
Close
Hashes for draw with percentage-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | edb630ad956e71c18d7870935ea2d0f4a0174a24cc80fd13f2e39f5a8a0fe8fb |
|
MD5 | 43ff407bcfcdd676a92a6c83ff987978 |
|
BLAKE2b-256 | 1c703e888cda98240ff94e38b0bbd9cbc069cbe492965e63cab6740efd27f50e |
Close
Hashes for draw_with_percentage-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e49ed8493d1c595152b3fb1a8ee6b11f65a51338a69291b4d4bb27f418c203 |
|
MD5 | 1d6164de8074b741ae4b17e7fa9860a2 |
|
BLAKE2b-256 | 612465db426d089860489ead7f922201125f7832c92e4b3c5f05e2548b938edb |