Lesson 7: Timed & Graded Multiplication test
Post date: Dec 14, 2018 4:01:24 PM
import random as r, time as t
q = int(input("How many questions?"))
input("Are you ready? Hit Enter.")
start = t.time()
score = 0
for i in range(0,q):
a = r.randint(0,12)
b = r.randint(0,12)
print("What is", a, "x", b, "?")
c = int(input())
if a*b == c:
print("Correct")
score = score + 1
else:
print("Incorrect. It is", a * b)
end = t.time()
p = (score/q)*100
print("You scored", p, "%")
print("It took you", end - start, "seconds")
if p >= 90:
print("Your grade is A")
elif p >= 80:
print("Your grade is B")
elif p >= 70:
print("Your grade is C")
elif p >= 60:
print("Your grade is D")
else:
print("Your grade is F")