For this blog, I will be discussing how 538’s baseball prediction works.
First, they start with creating Team Rankings. To do this they collected game results and box scores going all the way back to 1871. They used data to create an Elo-based rating system and predictive model for baseball that accounts for home-field advantage, the margin of victory, park, and era effects, travel, rest, and — most importantly — starting pitchers.
Every MLB team carries a rating that estimates its current skill level. The league average is about 1500.
After every game a team plays, their rankings are adjusted…
What’s a function? In Python, a function is a group of related statements that perform a specific task.
A parameter is the variable listed inside the parentheses in the function definition.
An argument is the value that is sent to the function when it is called.
defthat marks the start of the function header.
Lists are collections of data that are surrounded by brackets [ ] and each item in the list is separated by commas.
Strings, numbers, booleans, even other lists can be items in a list. Lists are ordered and mutable (changeable). This means that lists can be sorted and changed. The way we can change lists is through list methods.
They are many easy to use methods that can help us make sense of lists in Python
These quick and easy to use methods are great for editing and analyzing lists
append() Adds an element at the end of the list