This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = number of passengers | |
p = ticket price | |
c = % of passengers that will be checked for a ticket | |
v = % of passengers that are violators | |
F = fine | |
Np = Np(1-c)(1-v) + Npc(1-v) + Ncv*F | |
Solving for F, we get that F = p/c. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv, re | |
from collections import namedtuple, Counter | |
cols = ['date', 'dow', 'hours_slept', 'mood_morning', 'mood_day', 'mood_evening', 'breakfast', 'lunch', 'dinner', 'drinks', 'snacks', 'coffee', 'weight'] | |
StatDay = namedtuple('StatDay', cols) | |
RE_NON_WORD = re.compile('\W+') | |
RE_NUM = re.compile('\d+') |