+ 1
Fix my code, please
class Juice: def __init__(self, x, y): self.x = x self.y = y def __and__(self, other): return Juice (self.x + other.x) def __add__(self, other): return Juice(self.y + other.y) def __str__(self): return (self.x + '('+str(self.y)+'L)') first = Juice("Orange", 2) second = Juice("Apple", 1.5) result = first + second print(result.x, result.y) https://code.sololearn.com/cwiJK23KXuhA/?ref=app
4 Answers
+ 3
This will help you:
https://code.sololearn.com/cK53Snt5Z68l/?ref=app
+ 4
https://code.sololearn.com/catwxTpV1FRP/?ref=app
+ 2
JaScript Thank you. Now I am able to reach the output.
0
Oma Falk The ideal output would be "Orange&Apple (3.5L)". But thank you for your support.