Lesson 7: Multiplication test (Variables, Control-flow, Loops)
Post date: Dec 12, 2018 4:03:02 PM
import random
print("How many questions?")
q = int(input())
score = 0
for i in range(0,q):
a = random.randint(2,12)
b = random.randint(2,12)
print("What is", a, "x", b, "?")
c = int(input())
if a * b == c:
print("o - Correct. It is", c)
score = score + 1
else:
print("x - Incorrect. It is", a * b)
print("You scored", score, "points")
print("Percentage: ", (score / q) * 100,"%")