-
Notifications
You must be signed in to change notification settings - Fork 0
/
12days.py
28 lines (26 loc) · 912 Bytes
/
12days.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# This is a code golfing challenge. The goal is to write a program equivalent to
# this one, with the smallest number of bytes in the source file
# You can use any programming language you like
lyrics = [
"Twelve Drummers Drumming",
"Eleven Pipers Piping",
"Ten Lords a Leaping",
"Nine Ladies Dancing",
"Eight Maids a Milking",
"Seven Swans a Swimming",
"Six Geese a Laying",
"Five Golden Rings",
"Four Calling Birds",
"Three French Hens",
"Two Turtle Doves",
"partridge in a Pear Tree" ]
nums = ["first", "second", "third", "fourth", "fifth", "sixth", "seventh",
"eighth", "ninth", "tenth", "eleventh", "twelfth"]
for i in range(0,12):
print("On the " + nums[i] + " day of Christmas")
print("my true love sent to me:")
for j in range(0, i + 1):
l = lyrics[11 - i + j]
if j == i: print(("And a " if i > 1 else "A ") + l)
else: print(l)
if i != 11: print("")