Created
July 4, 2019 00:49
-
-
Save qpfiffer/a4835ff105bd4ad00c410a23c677c165 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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