Una botella tiene ml mililitros de agua, y cada sorbo se lleva sip mililitros. Termina drink(sip) en Bottle: quita el sorbo de la botella; si no queda suficiente, la botella se queda en 0, nunca por debajo.
water_left(500, [100, 150])→250water_left(300, [200, 200])→0class Bottle:
def __init__(self, ml):
self.ml = ml
def drink(self, sip):
# tu código aquí: resta el sorbo; si baja de 0, déjalo en 0
pass
def water_left(ml, sips):
bottle = Bottle(ml)
for sip in sips:
bottle.drink(sip)
return bottle.ml
Ejecutar prueba los ejemplos. Cuando salgan bien, Enviar.