Why is __str__ method not taking 2 params here.
I'm trying out the juicer program in python core. I want to print the output through the __str__method. This is my code: class Juice: def __init__(self, name, capacity): self.name = name self.capacity = capacity def __add__(self, other): result = self.capacity + other.capacity return result def __str__(self,other): return (self.name + '&' + other.name + ' ('+str(result)+'L)') a = Juice('Orange', 1.5) b = Juice('Apple', 2.0) result = a + b print(result) Error: The special method __str__ takes 0 params(s) , 1 was given. Can someone tell me why the __str__method is showing an error. If I don't mention 2nd argument(other) in str method, there is no error but my output would only be "3.5L" without the names. Also, I want to try printing the result through the str method. How do I do that? Required Output: Orange&Apple 3.5L