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.63 KB | None | 0 0
  1. class Bottle(object):
  2. def __init__(self):
  3. self.liquid = 100
  4. self.name = ""
  5. self.max_capacity = 500
  6. self.make = "Plastic"
  7.  
  8.  
  9. def print_details(bottle):
  10. print bottle.liquid, bottle.name, bottle.max_capacity, bottle.make
  11.  
  12.  
  13. def name_bottle(bottle, name):
  14. bottle.name = name
  15.  
  16.  
  17. def fill(bottle, amount):
  18. if bottle.max_capacity < bottle.liquid + amount:
  19. print "Overflow"
  20. else:
  21. bottle.liquid += amount
  22. print bottle.liquid
  23.  
  24.  
  25. def drink(bottle, amount):
  26. if amount > bottle.liquid:
  27. print "Finish"
  28. else:
  29. bottle.liquid -= amount
  30. print bottle.liquid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement