From 55374f960ab7326e8003ce43b9c545ae3400724d Mon Sep 17 00:00:00 2001 From: zevav Date: Sun, 12 Jan 2020 10:19:57 +0100 Subject: [PATCH] fixed #3 --- app/math_game.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/math_game.py b/app/math_game.py index 4219e8b..25937d4 100644 --- a/app/math_game.py +++ b/app/math_game.py @@ -1,4 +1,6 @@ -# copyright 2020 Simon Averbach and Zev Averbach +# (c) 2020 Simon Averbach and Zev Averbach +from time import sleep + from config import MAX_NUM @@ -14,10 +16,17 @@ def math_game(): number = int(input("> ")) print("How much do you want to add each time?") each = int(input("> ")) - print(f"Okay, here we go! We're going to count from zero to {number} by {each} at a time.") + + print("How many counts do you want to do per second?") + num_counts_per_second = int(input("> ")) + + print(f"Okay, here we go! We're going to count from zero to {number}, " + f"adding {each} {num_counts_per_second} times per second.") sleep(3) - for i in range(0, number, each): + sleep_for_seconds_between_counts = 1 / num_counts_per_second + for i in range(1, number + 1, each): print(f"{i:,}") + sleep(sleep_for_seconds_between_counts) if __name__ == "__main__":