Last active
August 29, 2015 14:13
-
-
Save Echocage/69a67bf277894f516efa to your computer and use it in GitHub Desktop.
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
verses = ["a Partridge in a Pear Tree", "Two Turtle Doves", "Three French Hens", "Four Calling Birds", | |
"Five Gold Rings", "Six Geese-a-Laying", "Seven Swans-a-Swimming", "Eight Maids-a-Milking", | |
"Nine Ladies Dancing", "Ten Lords-a-Leaping", "Eleven Pipers Piping", "Twelve Drummers Drumming"] | |
days = {index - 1: ', '.join(reversed(verses[:index - 1])) for index, verse in enumerate(verses)} | |
def get_day(day): | |
return "On the {} day of Christmas my true love sent to me,".format(day) + days[day] | |
def get_presents(start, end=None): | |
return sum(range(start, end + 1)) if end else sum(range(start)) | |
print(get_presents(11, 12)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment