Files
python-test/test11.py
T

26 lines
549 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
b'abcdefg'
str = b.encode('UTF-8')
for c in str:
if ord(c) >= 32 and ord(c) < 127:
print(c)
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)