Advertisement
karunesh

numcrunch

Apr 4th, 2012
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. # numCrunch
  2.  
  3. import random
  4.  
  5. inp = input("Press ENTER to start (-1 to end)...")
  6.  
  7. right = 0
  8. total = 0
  9.  
  10. i = 0
  11. while( int(i) != -1 ):
  12.     total += 1
  13.     mult = random.randint(11, 31)
  14.     num = random.randint(2, 9)
  15.     print(mult,"*",num)
  16.     i = input("")
  17.     if(int(i) == (mult * num)):
  18.         print('ok.....')
  19.         right += 1
  20.     else:
  21.         print('...............WRONG....... ', mult * num)
  22.  
  23.     print(mult * num)
  24.  
  25. print ('Done, your score := ',right,'/',(total - 1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement