Я хочу создать код, который будет выводить сумму приза продукта. Пример ниже.
Input:
bread,rice
Output:
6,5 $
Вот мой код:
class product:
def __init__(self,name,color,prize)
self.name=name
self.color=color
self.prize=prize
def info(self)
input(name)
return (self.prize)
tomato=product()
tomato.name="tomato"
tomato.color="czerwony"
tomato.prize= 4,56
turnip=product()
turnip.name="turnip"
turnip.color="white"
turnip.prize= 5.65
print("write the name of one products from the list and I will tell you how much it costs [tomato,turnip] "
info()
Товаров всего 2, я хотел сократить строки кода.