From 1827b01b12128c371f367eadad6042fd85db833a Mon Sep 17 00:00:00 2001 From: zevav Date: Sun, 12 Jan 2020 11:15:41 +0100 Subject: [PATCH] fixed bug that gave a bad suggested num counts per second --- app/math_game.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/math_game.py b/app/math_game.py index 6907187..d99af2d 100644 --- a/app/math_game.py +++ b/app/math_game.py @@ -1,4 +1,5 @@ # (c) 2020 Simon Averbach and Zev Averbach +import math from time import sleep from config import MAX_NUM, DEFAULT_COUNTING_SPEED, MAX_RUNNING_TIME_SECONDS @@ -21,6 +22,7 @@ def get_last_number(): last_number = int(input("> ")) return last_number + def get_increment(): return int(input("How much do you want to add each time?\n> ")) @@ -30,7 +32,7 @@ def predict_running_time(last_number, increment, num_counts_per_second): def calculate_suggested_num_counts_per_second(last_number, increment): - return int((last_number / increment) / MAX_RUNNING_TIME_SECONDS) + return math.ceil((last_number / increment) / MAX_RUNNING_TIME_SECONDS) def get_input(message, default_val):