#sample solution
class Bottle:
def __init__(self, liquid):
self.amount= 500
self.height = 10
self.empty = False
self.full = True
self.liquid = liquid
def amount_left(self):
return self.amount
def drink(self, amount):
if amount < self.amount:
self.amount -= amount
elif amount == self.amount:
self.empty = True
else:
print "Cannot drink more " + self.liquid + " than available"
#your method here
def refill(self, amount):
if(self.amount+amount>500):
print "You can't do that"
else:
self.amount+=amount
No comments:
Post a Comment