Created
December 23, 2015 10:56
-
-
Save Gustav-Simonsson/b6e34a3b701ea7c4e014 to your computer and use it in GitHub Desktop.
poem
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
# Poem: | |
# | |
#there are so many tictoc | |
#clocks everywhere telling people | |
#what tictoc time it is for | |
#tictic instance five toc minutes toc | |
#past six tic | |
#Spring is not regulated and does | |
#not get out of order nor do | |
#its hands a little jerking move | |
#over numbers slowly | |
# We do not | |
#wind it up it has no weights | |
#spring wheels inside of | |
#its slender self no indeed dear | |
#nothing of the kind. | |
#(So, when kiss Spring comes | |
#we'll kiss each kiss other on kiss the kiss | |
#lips because tic clocks toc don't make | |
#a toctic difference | |
#to kisskiss you and to | |
#kiss me) | |
# | |
# Python code implementing a subjective interpretation of the poem as | |
# a programmatic, executable function | |
import random | |
import datetime | |
# | |
# first paragraph; many tictoc clocks telling (printing to | |
# stdout) people what time it is | |
def poem(): | |
# example lazy interpretation of | |
# "what tictoc time it is for tictic instance five toc minutes toc past six tic" : | |
# print current time rounded back to last even 5th minute and if it's past 6 PM. | |
now = datetime.datetime.now() | |
hour = now.hour | |
minute = now.minute - (now.minute % 5) | |
past_six = "" | |
if hour >= 18: | |
past_six = "It's past six tic!" | |
# let "so many" be a random value at least 2 | |
so_many = 1 + random.randrange(10) | |
for i in range(so_many): | |
# let "telling people" be printing to stdout | |
print "tictoc time is: %d:%d %s" % (hour, minute, past_six) | |
# example interpretation of "Spring is not regulated..." | |
# TODO | |
return | |
# call function | |
poem() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment