interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / tasks / the-twelve-days-of-christmas / oracle.py

11 lines · 837 bytes Raw Blame History
1# Independent reference for "The Twelve Days of Christmas" (Python 3, standard library only).
2# expected.txt is this program's stdout; omc never produced it.
3days = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth']
4gifts = ['A partridge in a pear tree.', 'Two turtle doves,', 'Three french hens,', 'Four calling birds,', 'Five golden 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,']
5for d in range(12):
6 if d:
7 print()
8 print(f"On the {days[d]} day of Christmas,")
9 print("My true love sent to me:")
10 for g in range(d, -1, -1):
11 print("And a partridge in a pear tree." if g == 0 and d > 0 else gifts[g])