From e6694d6b3f787cb0afa9b23b0d6bde1b2ac810ec Mon Sep 17 00:00:00 2001 From: vand <vand@dtu.dk> Date: Thu, 10 Jun 2021 19:35:43 +0000 Subject: [PATCH] Upload New File --- module5_multiplication_game.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 module5_multiplication_game.py diff --git a/module5_multiplication_game.py b/module5_multiplication_game.py new file mode 100644 index 0000000..57e9770 --- /dev/null +++ b/module5_multiplication_game.py @@ -0,0 +1,19 @@ +print('Welcome to multiplication game!') +print('(Empty to quit)') +import random + +s = 'start' +while not s == '': + a = random.randint(0, 9) + b = random.randint(0, 9) + s = input(f'{a}*{b}=') + if not s=='': + try: + p = int(s) + if p == a*b: + print('Good job!') + else: + print('Oh, no, try again.') + except: + print("I don't understand that.") + \ No newline at end of file -- GitLab