Sha256: 9c67426cc7b94d8512ad2477b5b4c5b3b6e03d70a4a4862e0b21140e9d0b60b6
Contents?: true
Size: 965 Bytes
Versions: 55
Compression:
Stored size: 965 Bytes
Contents
GIFTS = ['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 Gold Rings', 'four Calling Birds', 'three French Hens', 'two Turtle Doves', 'a Partridge in a Pear Tree'] ORDINAL = [None, 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth'] def verse(day_number): gifts = GIFTS[-day_number:] if len(gifts) > 1: gifts[:-1] = [', '.join(gifts[:-1])] gifts = ', and '.join(gifts) return 'On the {} day of Christmas my true love gave to me, {}.\n'.format( ORDINAL[day_number], gifts) def verses(start, end): return ''.join([verse(n) + '\n' for n in range(start, end + 1)]) def sing(): return verses(1, 12)
Version data entries
55 entries across 55 versions & 1 rubygems