Code: Select all
import random()
def askquestion():
score=0
num1=random.randint(1,20)
num2=random.randint(1,20)
correctanswer=num1+num2
answer=input(str(num1)+"+"+str(num2)+"=")
if answer==correctanswer:
print("great work!!")
score=score+10
else:
print("Uh-ohh! Let's try another one!")
askquestion()
askquestion()
askquestion()
askquestion()
Mobile version