omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / tasks / the-twelve-days-of-christmas / oracle.py
| 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. |
| 3 | days = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth'] |
| 4 | gifts = ['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,'] |
| 5 | for 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]) |