We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6acadc7 commit f167d17Copy full SHA for f167d17
1 file changed
percentify/core.py
@@ -13,6 +13,6 @@ def percent(part: float, whole: float, decimals: int | None = 2) -> float:
13
14
"""
15
if whole == 0:
16
- return 0.0
+ raise ValueError("whole cannot be zero.")
17
value = (part / whole) * 100
18
return round(value, decimals) if decimals is not None else value
0 commit comments