Having an issue with writing functions to determine if firstly something is in a list and secondly in relation to the user having a bank balance.
essentially what the function needs to do is allow the user to use their balance to bet on a team and also for it to check if the team they have typed in is in the list of teams.
this is what i have so far if anybody could help me with this as i feel like it may need to be one function for both but can't work it out and other threads have not helped me, thanks.
team_list = ["Team1", "Team2", "Team3"]
def Team():
team = input("Please choose a team to bet on.")
if team in team_list:
print("You have selected",team)
else:
print("That team is not in the list please select one in the list")
return Team()
def Stake():
bank = float(50.0)
stake = float(input("Please enter a stake"))
if stake <= bank:
print("Your bet has been placed.", stake, "on", team)
bank -= stake
print(bank)
else:
print("You don't have enough money to place this")
return Stake()
Team()
Stake()
Aucun commentaire:
Enregistrer un commentaire