Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Bottle(object):
- def __init__(self):
- self.liquid = 100
- self.name = ""
- self.max_capacity = 500
- self.make = "Plastic"
- def print_details(bottle):
- print bottle.liquid, bottle.name, bottle.max_capacity, bottle.make
- def name_bottle(bottle, name):
- bottle.name = name
- def fill(bottle, amount):
- if bottle.max_capacity < bottle.liquid + amount:
- print "Overflow"
- else:
- bottle.liquid += amount
- print bottle.liquid
- def drink(bottle, amount):
- if amount > bottle.liquid:
- print "Finish"
- else:
- bottle.liquid -= amount
- print bottle.liquid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement