Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # old-macdonald.py
- filler = 'Ee-igh, '*2+'Oh!'
- animals = 'dog:woof,duck:quack,sheep:baa,cow:moo,cat:meow'.split(',')
- class C(): 0
- c = C()
- MAIN = '''Old MacDonald had a farm, {3}'''
- VERSE = '\n'+MAIN+'''
- And on that farm he had a {0}, {3}
- With a {2} here... and a {2} there.
- Here a {1}, there a {1}, everywhere a {2}!
- '''+MAIN
- def var(focus): c.animal, c.sound = focus.split(':')
- def sing(): print(VERSE.format(c.animal,c.sound,c.sound+' '+c.sound,filler))
- [(var(focus),sing()) for focus in animals]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement