Hi everyone so I’m doing the python " game of chance " practice project here is the link
and I’m stuck on exercise number 6 ( create a function that simulates some of the rules of roulette).
I created a global function called roulette and inside this function I created two other functions one called “guess_the_number” and the other one called “guess_high_or_low” each one does a different thing than the other my problem is when I want to run either of the local functions I get a “NameError” it says that function name is not defined so my question is how can I do that?.
btw here’s the code
def roulette(guess, bet):
def guess_the_number(guess, bet):
if guess == number_guessed:
bet += 35
return "Congratulation you won: " + str(bet) + "$"
else:
return "Sorry you lost"
return guess_the_number(guess, bet)
def guess_high_or_low(guess, bet):
if guess == "Low":
if number_guessed >= 1 and number_guessed <= 18:
print("It's Low")
bet += bet
return "Congratulation you won: " + str(bet) + "$"
else:
return "Sorry you lost the number was High!"
else:
if number_guessed >= 19 and number_guessed <=36:
print("It's High")
bet += bet
return "Congratulation you won: " + str(bet) + "$"
else:
return "Sorry you lost the number was Low!"
return guess_high_or_low(guess, bet)
print(guess_high_or_low("High", 50))