Skip to content

Instantly share code, notes, and snippets.

@qpfiffer

qpfiffer/thing.py

Created Jul 4, 2019
Embed
What would you like to do?
#!/usr/bin/env python3
from functools import reduce
TUPLES = (
(0,24),
(1,20),
(2,9),
(3,5),
(4,3),
(5,3),
(6,1),
(7,4),
(8,5),
(9,6),
(10,7),
(11,199),
(12,61),
(13,92),
(14,62),
(15,70),
(16,145),
(17,91),
(18,74),
(19,42),
(20,161),
(21,87),
(22,45),
(23,33),
)
group_hours = None
group_trips = None
for i in range(0, 24):
prev_hour, prev_trip = TUPLES[(i-1) % 24]
hour, trip = TUPLES[i]
next_hour, next_trip = TUPLES[(i+1) % 24]
if not group_hours or sum((prev_trip, trip, next_trip)) < sum(group_trips):
group_hours = (prev_hour, hour, next_hour)
group_trips = (prev_trip, trip, next_trip)
print("LOWEST: {}".format(list(zip(group_hours, group_trips))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.