Added sample files for day 2 and 3
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user