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)
2 ответов
+ 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.
0
Ok ty