Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- gameInitiate = False
- if gameInitiate == False:
- input('Press enter to start.')
- gameInitiate = True
- def shellgame():
- print('Welcome to shell game.')
- print('I\'m going to put a shell under one of these cups.')
- print(' ,+. ,+. ,+.')
- print('//|\\ //|\\ //|\\')
- print('||||| ||||| |||||')
- computerShell = random.randint(1, 3)
- userMoney = 100
- gamePlaying = True
- while gamePlaying == True:
- userBet = int(input('Would you like to place a bet? Enter how much.'))
- if userBet > userMoney:
- print('Sorry! You only have ' + str(userMoney) + '!')
- else:
- userMoney -= userBet
- userChoice = input('Type 1 2 or 3 to pick a cup.')
- if int(userChoice) == int(computerShell):
- userWinnings = userBet * 2
- print(computerShell)
- playAgain = input('Congratulations! You won! Play again?')
- if playAgain == ('Yes'):
- gamePlaying = True
- if playAgain == ('No'):
- print('Bye!')
- gamePlaying = False
- if int(userChoice) != int(computerShell):
- playAgain = input('Sorry! You lost. Play again?')
- if playAgain == ('Yes'):
- gamePlaying = True
- if playAgain == ('No'):
- print('Bye!')
- gamePlaying = False
- shellgame()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement