Ver código fonte

Fix division by 0

Summary: As in title

Differential Revision: D8608223

fbshipit-source-id: 0286e7ae6204f3e96df176f693f8aa535eb9d7ff
Aleksandra Piktus 7 anos atrás
pai
commit
25d0bb04bf
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      python/doc/examples/compute_accuracy.py

+ 5 - 1
python/doc/examples/compute_accuracy.py

@@ -156,5 +156,9 @@ if __name__ == "__main__":
 
     print(
         "Questions seen / total: {0} {1}   {2:.2f} %".
-        format(total_qs, total_num_lines, total_qs / total_num_lines * 100)
+        format(
+            total_qs,
+            total_num_lines,
+            total_qs / total_num_lines * 100 if total_num_lines > 0 else 0,
+        )
     )