Created
July 16, 2019 10:06
-
-
Save louisswarren/0d92923f594db540fd1ede984bbf9771 to your computer and use it in GitHub Desktop.
28 hour day
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
days = ['Monday', 'Tuesday', 'Wednesday', | |
'Thursday', 'Friday', 'Saturday', 'Sunday'] | |
def time(n): | |
day = days[(n // 24) % 7] | |
n = n % 24 | |
if n == 0: | |
hour = '12am' | |
elif n < 12: | |
hour = f'{n}am' | |
elif n == 12: | |
hour = f'{n}pm' | |
else: | |
n = n % 12 | |
hour = f'{n}pm' | |
return f'{day} {hour}' | |
def cycle28(n=0): | |
while True: | |
yield n | |
n += 28 | |
n = -6 | |
for i in range(6): | |
print("Wake: {} - {}".format(time(n), time(n + 20))) | |
print("\tSleep: {} - {}".format(time(n + 20), time(n + 28))) | |
n += 28 | |
""" | |
Wake: Sunday 6pm - Monday 2pm | |
Sleep: Monday 2pm - Monday 10pm | |
Wake: Monday 10pm - Tuesday 6pm | |
Sleep: Tuesday 6pm - Wednesday 2am | |
Wake: Wednesday 2am - Wednesday 10pm | |
Sleep: Wednesday 10pm - Thursday 6am | |
Wake: Thursday 6am - Friday 2am | |
Sleep: Friday 2am - Friday 10am | |
Wake: Friday 10am - Saturday 6am | |
Sleep: Saturday 6am - Saturday 2pm | |
Wake: Saturday 2pm - Sunday 10am | |
Sleep: Sunday 10am - Sunday 6pm | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment