Advertisement
baggiepr

Ryan Comments his Maths Quiz

Jan 30th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import random
  2. score=0#what your score is
  3. for i in range(10):#tell the computure how many questionsto do
  4.     num1=random.randint(2,12)#inputs a random number between 2 and 12
  5.     num2=random.randint(2,12)
  6.     rightanswer=num1*num2#it "x" the two random numbers to gether
  7.     print(num1,"X",num2,"= ?")#it lets you type in the answer
  8.     choice=int(input("What is the answer?"))
  9.     if rightanswer == choice:
  10.         print("Correct")#under the collculsion it will tell you if is's correct
  11.         score=score+1#it will +1 point
  12.     else:#if youtype in something eles it will do incorrect
  13.         print("Incorrect")#under the collculsion it will tell you if is's incorrect
  14.     print("your score is",score)#when you have done the collculasion it tells you your score after the collculsion
  15. print ("your final score is",score,"out of 10")#tells you what score  is at the end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement