I am trying to create a simple game of roulette and as a beginner in python i am having a few issues.
So far, i have the code below, and have created a few functions in an attempt to make the users input activate different functions. I have created some test statements in the red/black and odd/even functions, however, no matter what the input is i only get the output from the red/black functions (10 if i input red or 20 for any other input). Any help appreciated !
import random, time
# the spin and result of the roulette wheel
def spin():
print("Wheel is spinning...")
time.sleep(3)
land_number = random.randint(0,36)
print (land_number)
def number_chosen(x):
pass
def red_black_chosen(chosen_bet):
if chosen_bet == 'red':
red = 10
print(red)
else:
black = 20
print(black)
def odd_even_chosen(chosen_bet):
if chosen_bet == 'odd':
odd = 'qwe'
print(odd)
else:
even = 'abc'
print(even)
def high_low_chosen(chosen_bet):
pass
def dozen_chosen(chosen_bet):
pass
#choice of bet
def betters_choice():
print("""How would you like to bet? \n
Choose a number
Choose red or black
Choose odd or even
Choose low(1-18) or high(19-36
Choose 1st dozen(1-12), 2nd dozen(13-24) or 3rd dozen(25-
36)""")
global chosen_bet
chosen_bet = input()
if type(chosen_bet) == int:
if chosen_bet < 0:
print("Bet must be between 0 and 36")
elif chosen_bet > 36:
print("Bet must be between 0 and 36")
else:
number_chosen(chosen_bet)
elif chosen_bet == 'red' or 'black':
red_black_chosen(chosen_bet)
elif chosen_bet == 'odd' or 'even':
odd_even_chosen(chosen_bet)
elif chosen_bet == 'low' or 'high':
high_low_chosen(chosen_bet)
elif chosen_bet in ['1st dozen', '2nd dozen', '3rd dozen']:
dozen_chosen(chosen_bet)
else:
print("Incorrect bet chosen")
betters_choice()
betters_choice()