Advertisement
here2share

# old-macdonald.py

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