G2A Many GEOs
SHARE
TWEET

Untitled

Yegor2305 Apr 9th, 2020 129 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Beverage:
  2.     prices = {"Strawberries" : 1.5, "Banana" : 0.5, "Mango" : 2.5,
  3.         "Blueberries" : 1, "Raspberries" : 1, "Apple" : 1.75,
  4.         "Pineapple" : 3.5}
  5.  
  6.     def __init__(self, ingredients):
  7.         self.ingredients = ingredients
  8.  
  9.     def get_cost(self):
  10.         for i in self.ingredients:
  11.             return Beverage.prices[i]
  12.  
  13.     def get_price(self):
  14.         price = Beverage.get_cost(self)
  15.         return price * 2.5
  16.  
  17.     def get_name(self):
  18.         if len(self.ingredients) > 1:
  19.             return ' '.join(self.ingredients.sort()) + ' Fusion'
  20.         else:
  21.             return ' '.join(self.ingredients.sort()) + ' Smoothie'
  22.  
  23. b1 = Beverage(['Banana', 'Strawberries'])
  24. print(b1.ingredients)
  25. print(b1.get_cost())
  26. print(b1.get_price())
  27. print(b1.get_name())
RAW Paste Data
Ledger Nano X - The secure hardware wallet
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