repl.it
@nmakry/

Roulette: Stay on your bet

Python

A simple and funny roulette game. Bet each row on a specific number and see if you will win or get broke. Be wise and not greedy :)

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import random

while True:
  coins = input("How many coins do you have? ")
  coins = int(coins)
  if coins > 0:
    while True:
      bet = input("What is your bet? ")
      bet = int(bet)
      if 0 <= bet <= coins:
        break
      else:
        print("Bet should be between 1 and your coins.\n")
    break  
  else:
    print("Coins should be greater than zero.\n")

i="Y"

while i.upper() == "Y":
  while True:
    n = input("Enter roulette number to bet on (0 - 36): ")
    n = int(n)
    if 0 <= n <= 36:
      break
    else:
      print("Enter a number between 0 and 36. Please try again.\n")

  while True:
    r = random.randint(0,36)
    coins -= bet
    if coins < 0 or r == n:
      break
    print("Roulette number: " + str(r))

  if coins < 0:
    print("You are broke! You've lost everything. Get out of here, NOW!\n")
    break

  coins = coins + (33 * bet)
  print("You win and you have: " + str(coins) + " coins.\n")
  i = input("Do you want to play more? (y/n) ")
  
if coins > 0:
  print("Go home with your winings.\n")
Fetching token
?