OOP in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

OOP in python

I have a question on how I can add the two tuples a and b ,and my output should be Orange&Apple(3.5) my code is class Juice: def __add__(a,b): a=Juice('orange,1.5) b=Juice('Apple',2.0) result= a+b print(result)

31st Jul 2021, 3:04 PM
ndatinya justin
ndatinya justin - avatar
2 Answers
31st Jul 2021, 3:07 PM
JaScript
JaScript - avatar
+ 1
Thank you
31st Jul 2021, 3:26 PM
ndatinya justin
ndatinya justin - avatar