Skip to content

Instantly share code, notes, and snippets.

@sylhare
Created June 22, 2020 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sylhare/dad7ed1ef3d13614c77c4ebadf8a11c3 to your computer and use it in GitHub Desktop.
Save sylhare/dad7ed1ef3d13614c77c4ebadf8a11c3 to your computer and use it in GitHub Desktop.
type-on-strap-gist
#!/usr/bin/env python3
""" https://wiki.python.org/moin/SimplePrograms """
from time import localtime
activities = {8: 'Sleeping', 9: 'Commuting',
17: 'Working', 18: 'Commuting',
20: 'Eating', 22: 'Resting' }
time_now = localtime()
hour = time_now.tm_hour
for activity_time in sorted(activities.keys()):
if hour < activity_time:
print (activities[activity_time])
break
else:
print ('Unknown, AFK or sleeping!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment