From 4119c5e53778783df3d5315c6f49a43243c876e7 Mon Sep 17 00:00:00 2001 From: Jeffrey Elkner Date: Tue, 18 Jul 2023 07:36:42 -0400 Subject: [PATCH] Add Challenge 5 solution --- GASP/Sheet2/mathquiz.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 GASP/Sheet2/mathquiz.py diff --git a/GASP/Sheet2/mathquiz.py b/GASP/Sheet2/mathquiz.py new file mode 100644 index 0000000..b3b2760 --- /dev/null +++ b/GASP/Sheet2/mathquiz.py @@ -0,0 +1,12 @@ +from random import randint + +num1 = randint(1, 10) +num2 = randint(1, 10) + +question = f"What is {num1} times {num2}? " +answer = int(input(question)) + +if answer == num1 * num2: + print("Yes, great work!") +else: + print(f"No, I'm afraid the correct answer it {num1 * num2}.")