Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. class WaterBottle(object):
  2. def __init__(self):
  3. self.water = 100
  4. self.max_capacity = 500
  5. self.make = "Plastic"
  6.  
  7. def add_water(self, amount):
  8. if self.max_capacity < self.water + amount:
  9. self.water = self.max_capacity
  10. print "OverFlow"
  11. else:
  12. self.water += amount
  13. print self.water
  14.  
  15. def drink_water(self, amount):
  16. if amount > self.water:
  17. self.water = 0
  18. print "Finish"
  19. else:
  20. self.water -= amount
  21. print self.water
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement