Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. capital = int(input('What is your starting capital? ')) # starting capital of the player
  2. amount = input('What amount do you want to bet? ')
  3.  
  4. if amount == 'all':
  5. amount = capital
  6. else:
  7. amount = int(amount)
  8.  
  9. while capital >= 0 and amount != 'stop':
  10.  
  11. if amount <= capital:
  12. bet = str(input('Bet on red or black: ')) # bet on red or black
  13. land = str(input('Result: ')) # colour the ball lands on
  14. if bet == land:
  15. capital += amount
  16. else:
  17. capital -= amount
  18. else:
  19. print(f'You cannot bet {amount} if you only have {capital} dollar.')
  20.  
  21. amount = input('What amount do you want to bet? ')
  22.  
  23. if amount == 'stop':
  24. print(f'You end up with {capital} dollar.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement