Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- score=0
- for i in range(10):
- num1=random.randint(2,12) # this is the number that is timesed
- num2=random.randint(2,12) # this is the number that is timesed
- rightanswer=num1*num2 # this is the thing you are timsing together
- print(num1,"x",num2,"=?") # this is the question
- choice=int(input("What is the answer?")) # this is used so you can tipe the answer in when you press play
- print(choice)
- if rightanswer == choice:
- print("Correct") # this tells you if it is correct
- score=score+1 # this is that if you get a answer right you get 1 point
- else: # this is to tell the computer that it is somthing diffrent
- print("Incorrect") # this tells you if it is wronge
- print("Your score so far is",score,"out of 10") # this tells you the score during the time you are doing it
- print("your final score out of 10 is",score) # at the end it tells you final score
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement