SHARE
TWEET

Untitled

a guest Mar 25th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Fruit(object):
  2.   """A class that makes various tasty fruits."""
  3.   def __init__(self, name, color, flavor, poisonous):
  4.     self.name = name
  5.     self.color = color
  6.     self.flavor = flavor
  7.     self.poisonous = poisonous
  8.  
  9.   def description(self):
  10.     print "I'm a %s %s and I taste %s." % (self.color, self.name, self.flavor)
  11.  
  12.   def is_edible(self):
  13.     if not self.poisonous:
  14.       print "Yep! I'm edible."
  15.     else:
  16.       print "Don't eat me! I am super poisonous."
  17.  
  18. lemon = Fruit("lemon", "yellow", "sour", False)
  19.  
  20. lemon.description()
  21. lemon.is_edible()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top