Files

20 lines
444 B
Python

class TomatoPrice:
price: float
def __init__(self, value):
self.price = value
def __str__(self):
return f"USD${self.price}"
def __radd__(self, operand):
self.price += operand.price
vietnam = TomatoPrice(3.0)
japan = TomatoPrice(4.0)
korea = TomatoPrice(5.0)
vietnam + japan
output = "price of tomatoes in countries A, B, C: " + str(vietnam) + " " + str(japan) + " " + str(korea) + " "
print(output)