print ('Афанасьев А.И.')
class Product:
moneyAmount = 120
def __init__(self, name, price):
self.name = name
self.price = price
def opportunityToBuy(self):
if self.price < self.moneyAmount:
print(f"Вы можете купить {self.name}")
else:
print(f"Вы не можете купить {self.name}")
Product("капучино", 200).opportunityToBuy()
Product("эспрессо", 100).opportunityToBuy()
Product("воду", 50).opportunityToBuy()
Product("вино", 500).opportunityToBuy()