Skip to content

Instantly share code, notes, and snippets.

@sylhare

sylhare/example.py

Created Jun 22, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.