Created
December 12, 2012 13:51
-
-
Save anonymous/4267849 to your computer and use it in GitHub Desktop.
xmas market invitation in Python
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
# -*- coding: utf-8 -*- | |
# | |
# frwd to other interested parties at the institute | |
# | |
import datetime | |
import time | |
leave_at = datetime.datetime(2012,12,13,12,00) | |
while True: | |
delta = leave_at - datetime.datetime.now() | |
if abs(delta.seconds) < 120: | |
raise SystemExit, u"Immediately leave for *xmas market Esslingen*, " +\ | |
u"12:14 S-Bahn UNIVERSITÄT, 13th Dec. 2012" | |
elif delta.seconds > 0: | |
hh = delta.seconds / 3600 | |
mm = (delta.seconds % 3600) / 60 | |
ss = delta.seconds % 60 | |
print("Leave for *xmas market Esslingen* in %dh %dm %ds" % | |
(hh, mm, ss)) | |
else: | |
raise ValueError, "Too late, you missed joining us!" | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment