Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
450 B
1
Indexable
Never
import math defpoisson(actual, expected):return math.exp(-expected) * (expected**actual) / math.factorial(actual) # Example usagehome_team_avg_goals = 1.5away_team_avg_goals = 1.2 fori in range(5):  # calculate probability for first 5 score outcomes home_goals = i for j in range(5): away_goals = j p = poisson(home_goals, home_team_avg_goals) * poisson(away_goals, away_team_avg_goals)print(f"Probability of score {home_goals}-{away_goals}: {p:.4f}"