I am very new to python and have been reading up on python scoping however i am struggling with using values from a previous function e.g. in this case how do i get the randomly generated home and away goals to be used in the second function?. Please bare in mind i have only just began learning python so my code will not be the best attempt at all. Any help would be greatly appreciated as i could not find any threads relevant to my situation, thanks.
class One():
def Team(home_goals,away_goals):
home_goals = ()
away_goals = ()
home_goals = round(random.uniform(0,10.0)
return home_goals
away_goals = round(random.uniform(0.1,10.0)
return away_goals
def winner(home_goals,away_goals):
if home_goals > away_goals
winner = ("home")
elif home_goals == away goals
winner = ("draw")
else:
winner = ("away")
print(winner)
return winner
Aucun commentaire:
Enregistrer un commentaire