Skip to content

Commit 6caa559

Browse files
committed
Catch ZeroDivisionError in ACPL calculation
Closes #29
1 parent 00961cf commit 6caa559

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

annotator/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,10 @@ def acpl(cpl_list):
400400
Average Centipawn Loss
401401
Takes a list of integers and returns an average of the list contents
402402
"""
403-
return sum(cpl_list) / len(cpl_list)
403+
try:
404+
return sum(cpl_list) / len(cpl_list)
405+
except ZeroDivisionError:
406+
return 0
404407

405408

406409
def clean_game(game):

0 commit comments

Comments
 (0)