Advertisement
baggiepr

Vicky Y6 Orchard Lea Comments her code

Feb 6th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. import random
  2. score=0
  3. for i in range(10):
  4.     num1=random.randint(2,12) # this is the number that is timesed
  5.     num2=random.randint(2,12) # this is the number that is timesed
  6.     rightanswer=num1*num2 # this is the thing you are timsing together
  7.     print(num1,"x",num2,"=?") # this is the question
  8.     choice=int(input("What is the answer?")) # this is used so you can tipe the answer in when you press play
  9.     print(choice)
  10.     if rightanswer == choice:
  11.         print("Correct") # this tells you if it is correct
  12.         score=score+1 # this is that if you get a answer right you get 1 point
  13.     else: # this is to tell the computer that it is somthing diffrent
  14.         print("Incorrect") # this tells you if it is wronge
  15.     print("Your score so far is",score,"out of 10") # this tells you the score during the time you are doing it
  16. 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