Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. import random
  2. gameInitiate = False
  3. if gameInitiate == False:
  4. input('Press enter to start.')
  5. gameInitiate = True
  6.  
  7. def shellgame():
  8. print('Welcome to shell game.')
  9. print('I\'m going to put a shell under one of these cups.')
  10. print(' ,+. ,+. ,+.')
  11. print('//|\\ //|\\ //|\\')
  12. print('||||| ||||| |||||')
  13. computerShell = random.randint(1, 3)
  14. userMoney = 100
  15. gamePlaying = True
  16. while gamePlaying == True:
  17. userBet = int(input('Would you like to place a bet? Enter how much.'))
  18.  
  19. if userBet > userMoney:
  20. print('Sorry! You only have ' + str(userMoney) + '!')
  21. else:
  22. userMoney -= userBet
  23. userChoice = input('Type 1 2 or 3 to pick a cup.')
  24. if int(userChoice) == int(computerShell):
  25. userWinnings = userBet * 2
  26. print(computerShell)
  27. playAgain = input('Congratulations! You won! Play again?')
  28. if playAgain == ('Yes'):
  29. gamePlaying = True
  30. if playAgain == ('No'):
  31. print('Bye!')
  32. gamePlaying = False
  33. if int(userChoice) != int(computerShell):
  34. playAgain = input('Sorry! You lost. Play again?')
  35. if playAgain == ('Yes'):
  36. gamePlaying = True
  37. if playAgain == ('No'):
  38. print('Bye!')
  39. gamePlaying = False
  40.  
  41.  
  42. shellgame()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement