I am trying to write a simple math questions game in python3. My problem is timer function dones't return score. What am I missing here?
import random, time
n = 2
a = 0
def timer():
stime = time.time()
answ = soru()
score = round(time.time()- stime,2)
print(score,"ara zaman")
if answ == True:
return score
else:
return 0
def soru():
return top()
def top():
n1 = random.randint(1,n*5)
n2 = random.randint(1,n*5)
tansw = n1 + n2
ques = print(str(n1)+"+"+str(n2)+"=?")
pansw = input("-->")
if pansw == tansw:
print("doru")
return True
else:
return False
for i in range(4):
a += timer()
print(a)
print(a)