First, we get the game data for the game we want. In this instance, I am getting game data for the Indianapolis vs Cincinnati game in the 4th week of the 2016 preseason and setting it to the variable g. Next, we will get the current number of scoring plays (scores0), number of home/away team turnovers (home/awayto0), number of home/away penalties (home/awaypenalty0), and finally, the number of yards that resulted from home/away penalties (home/awaypenyds0).
The rest of the script runs while the game is still in progress. To check if the game is in progress, we use g.game_over(). If this object is False, the game is ongoing:
I did not know about the nflgame module and I think my life has just become better as a result of learning about this.