Created
April 22, 2016 15:28
-
-
Save steinnes/7f222ffdbd0804d028105c97d855f7bc to your computer and use it in GitHub Desktop.
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 time | |
timings = ( | |
(1, 'up'), | |
(2, 'down'), | |
(7, 'up'), | |
(8, 'down'), | |
(13, 'up'), | |
(14, 'down'), | |
(19, 'up'), | |
(20, 'down'), | |
(25, 'up'), | |
(26, 'down'), | |
(31, 'up'), | |
(32, 'down'), | |
(37, 'up'), | |
(38, 'down'), | |
(43, 'up'), | |
(44, 'down'), | |
(55, 'up'), | |
(56, 'down'), | |
(61, 'up'), | |
(62, 'down'), | |
(67, 'up'), | |
(68, 'down'), | |
(73, 'up'), | |
(74, 'down'), | |
(79, 'up'), | |
(80, 'down'), | |
(91, 'up'), | |
(92, 'down'), | |
(97, 'up'), | |
(98, 'down'), | |
(103, 'up'), | |
(104, 'down'), | |
(109, 'up'), | |
(110, 'down'), | |
(115, 'up'), | |
(116, 'down'), | |
(127, 'up'), | |
(128, 'down'), | |
(133, 'up'), | |
(134, 'down'), | |
(139, 'up'), | |
(140, 'down'), | |
(145, 'up'), | |
(146, 'down'), | |
(150, 'up'), | |
(152, 'down'), | |
(157, 'up'), | |
(158, 'down'), | |
(163, 'up'), | |
(164, 'down'), | |
(169, 'up'), | |
(170, 'down'), | |
(174, 'up'), | |
(175, 'down'), | |
(180, 'up'), | |
(181, 'down'), | |
(186, 'up'), | |
(188, 'down'), | |
(192, 'up'), | |
(193, 'down'), | |
(203, 'up'), | |
) | |
elapsed = 0 | |
unit = 0.01 | |
totals = {'up': 0, 'down': 0} | |
state = 'down' | |
try: | |
for t in timings: | |
while elapsed <= t[0]: | |
time.sleep(unit) | |
elapsed += unit | |
totals[state] += unit | |
print 'Bring sally {}'.format(t[1]) | |
state = t[1] | |
except KeyboardInterrupt: | |
pass | |
print "Total time up: {}".format(totals['up']) | |
print "Total time down: {}".format(totals['down']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment