Skip to content

Instantly share code, notes, and snippets.

@Echocage
Created January 15, 2015 01:20
Show Gist options
  • Save Echocage/2bfd26ad5beeecd26c89 to your computer and use it in GitHub Desktop.
Save Echocage/2bfd26ad5beeecd26c89 to your computer and use it in GitHub Desktop.
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)) if not end else sum(range(start, end + 1))
print(get_presents(11, 12))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment