aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-05-20 17:26:07 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-05-20 17:26:07 -0400
commit9778dc04e2843e9ab71f59031ed7d755515795d0 (patch)
tree63a225451b6c98d7fd84c1a317497d99d9b9a6a1
parent3d78bb9413b8b25f267c5372e5994d2c776630d7 (diff)
fix div by zero
-rwxr-xr-xsrc/score_mers.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/score_mers.py b/src/score_mers.py
index 43037e4..865ac24 100755
--- a/src/score_mers.py
+++ b/src/score_mers.py
@@ -204,6 +204,8 @@ def percentage(part, whole, precision=2):
part = float(part)
whole = float(whole)
+ if whole == 0:
+ return '0.0%'
percent = round(part / whole * 100, precision)
if(percent < 10):