Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class WaterBottle(object):
- def __init__(self):
- self.water = 100
- self.max_capacity = 500
- self.make = "Plastic"
- def add_water(self, amount):
- if self.max_capacity < self.water + amount:
- self.water = self.max_capacity
- print "OverFlow"
- else:
- self.water += amount
- print self.water
- def drink_water(self, amount):
- if amount > self.water:
- self.water = 0
- print "Finish"
- else:
- self.water -= amount
- print self.water
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement