0
Juice maker code required??
3 Réponses
+ 5
RONAK PATIL ,
to get useful help from the community, we need to see your attempt first. without having seen your code, it is difficult to find out where the issue is.
=> please put your code in playground and link it here
thanks!
0
Here you go!
A ready made solution to suit all tastes
https://code.sololearn.com/c7Uq5PpPsvD8/?ref=app
0
class Juice:
def __init__(self, name, capacity):
self.name = name
self.capacity = capacity
def __str__(self):
return (self.name + ' ('+str(self.capacity)+'L)')
def __add__(self,other):
sum=self.capacity+other.capacity
return self.name+"&"+other.name+" "+"("+str(sum)+"L)"
a = Juice('Orange', 1.5)
b = Juice('Apple', 2.0)
result = a + b
print(result)