Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Python 2
- lister = ['extra-input to cover the 0',
- 'A Partridge in a Pear Tree.',
- '2 Turtle Doves',
- '3 French Hens',
- '4 Colly Birds',
- '5 Golden Rings',
- '6 Geese-a-Laying',
- '7 Swans-a-Swimming',
- '8 Maids-a-Milking',
- '9 Ladies Dancing',
- '10 Lords-a-Leaping',
- '11 Pipers Piping',
- '12 Drummers Drumming']
- nth = ['th', 'st', 'nd', 'rd']
- # Recursively print individual verses
- def verse (n):
- if 1 <= n <= 12:
- print lister[n]
- if n == 2: print "And",
- verse(n - 1)
- # Recursively print the carol from the starting verse
- def carol (n):
- if 1 <= n <= 12:
- print "On the %d%s day of Christmas, my true love gave to me..." % (
- n, nth[n if n < 4 else 0])
- verse(n)
- print ""
- carol(n - 1)
- what_verse = int(raw_input('What verse (1-12) do you want? '))
- carol(what_verse)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement