Advertisement
Suavae

Python_Multiplication_Game_Practice

Apr 1st, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import random
  2.  
  3. def multiplyGame():
  4.     number1 = random.randint(1, 100)
  5.     number2 = random.randint(1, 10)
  6.    
  7.     print('What is ' + str(number1) + ' * ' + str(number2) + '?')
  8.     answer = input()
  9.     if int(answer) == number1 * number2:
  10.         print('Correct!')
  11.     else:
  12.         print('Nope! The answer is ' + str(number1 * number2))
  13.    
  14.        
  15. playAgain = 'yes'
  16. while playAgain == 'yes' or playAgain == 'y':
  17.     multiplyGame()
  18.    
  19.     print('Do you want to play again? (y or n)')
  20.     playAgain = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement