What's wrong with this juice maker python code? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

What's wrong with this juice maker python code?

class Juice: def __init__(self, name, capacity): self.name = name self.capacity = capacity def __str__(self): return (self.name + ' ('+str(self.capacity)+'L)') a = Juice('Orange', 1.5) b = Juice('Apple', 2.0) result = a + b print(result)

8th Jul 2022, 5:51 AM
shifa
shifa - avatar
2 Respuestas
+ 1
shifa There is nothing wrong. This code is already given by SoloLearn. You just have to add new method __add__ Explanation is already given there.
8th Jul 2022, 6:07 AM
A͢J
A͢J - avatar
0
Ok ty
8th Jul 2022, 6:07 AM
shifa
shifa - avatar