0

Juice maker code required??

19th Oct 2021, 8:06 AM
RONAK PATIL
RONAK PATIL - avatar
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!
19th Oct 2021, 10:49 AM
Lothar
Lothar - avatar
0
Here you go! A ready made solution to suit all tastes https://code.sololearn.com/c7Uq5PpPsvD8/?ref=app
19th Oct 2021, 8:46 AM
Rik Wittkopp
Rik Wittkopp - avatar
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)
13th Jul 2022, 10:21 PM
Najwan N
Najwan N - avatar