Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random # when you're playing the quiz it changes the numbers.
- score=0 # it tells you what your score is at the beginning.
- for i in range(15): #how many times it will repeat.
- num1=random.randint(2,12)
- num2=random.randint(2,12)
- #print(num1,num2)
- rightanswer=num1*num2
- #print(num1,num2,rihgtanswer)
- print(num1,"x",num2,"=?")
- choice=int(input("What is the answer?")) #a tab will come up and it will say (what is the anwser) then you put the a number then enter it.
- #print(choice)
- if rightanswer == choice:
- print("correct") #if the anser is right it will come up with correct.
- score=score+1 #it adds a point if you get the anwser correct.
- else:
- print("incorrect")#when a anwser is wrong it will come up with incorrect.
- print("your score so far is",score,"out of 15")
- print("your final scossssssssssssssssssssre is",score) #the score you get at the end and says what score you got out of the number you put in i in range like 15 then it will tell you what score yo've got out of 15.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement