Advertisement
Guest User

Untitled

a guest
Apr 27th, 2018
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. class Fruit(Object):
  2.    _keyword = None
  3.    def use(self):
  4.       if self._keyword == 'tasty':
  5.           print('Close your eyes and enjoy the flavour')
  6.       else:
  7.           print('Shut up and eat')
  8.  
  9. class Orange(Fruit):
  10.     _keyword = 'tasty'
  11.  
  12. class Banana(Fruit):
  13.     _keyword = 'Not too tasty'
  14.  
  15. class Coconut(Fruit):
  16.     _keyword = 'Hard'
  17.     def use(self):
  18.         print('This thing is {}, Smash someone's head'.format(self._keyword))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement