Created
January 14, 2015 23:32
-
-
Save Echocage/cdae0fb77b58b5cc723e 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"] | |
for index, verse in enumerate(verses): | |
day = index + 1 | |
previous_verses = verses[:day] # This cuts out and returns all elements from 0, to day from the list of verses | |
ordered_verses = reversed(previous_verses) | |
# Shockingly, this ^ reverses the list, so we have a list of elements starting from the newest item to the oldest | |
chorus = "On the {} day of Christmas my true love sent to me,".format(day) | |
# Format, based on C's format, is a very flexible tool, in this case it replaces {} with day | |
print(chorus, ', '.join(ordered_verses)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment