Part II
Modeling UEFA Euro 2020
A Python Approach
The first part of our modeling UEFA Euro 2020 article, in case you want to start there:
Modeling the Data
We are all responsible Python programmers (or at least pretend to be responsible Python programmers), so let’s implement the model as a class Team. A team has a name and strength. The team’s strength would be estimated by a subject-matter expert (SME): someone who knows European soccer better than an average Python programmer. If we cannot get hold of such an expert or cannot afford to pay them, let’s choose strength uniformly at random from the range 0 through 1. Rumor has it that some experts do precisely that.
The class also has a static variable, LUCK. For the lack of a better guess, let’s set luck to 0.
import random as rndclass Team:
LUCK = 0.0 def __init__(self, name, strength = None):
self.name = name
self.strength = strength if strength else rnd.uniform(0,1)