как умножить параметр в число с плавающей точкой, используя декораторы (python) - PullRequest
0 голосов
/ 06 июля 2019

Я хочу умножить переменную 'цена' на 1,14, но только с использованием декораторов.каков синтаксис функции декоратора?

def insert(self):
    o_num = self.get_max_id()+1 #to assign a new number or id to the order in the list and they are sequential using another function
    o_name = input("Please enter size letter -S,M,L- of your desired dish  ") #to get the size of the wanted dish
    qnt = self.get_int_value("Please enter qnt  ") #to get the quantaty of wanted dishes using another function
    price = qnt #this code to insure that the variable price is declared before mentioning

    #these if statment are used to choose the correct price of the dishes
    if(o_name.lower()== "s"):
        price = price * 5.0

    if(o_name.lower()=="m"):
        price = price * 8.0

    if(o_name.lower()=="l"):
        price = price * 10.0

    #these two lines are used to assign the variables we got from the user to the 'orders' list
    order = Order(o_num,o_name,int(qnt),price)
    self.orders.append(order)
...