Generation

generate functionSun, 11 Dec 2022

Change the code in this program so that the value of 'quantity' is multiplied by the variable 'portions' and the result is displayed: cook_book = { 'пицца': [ {'ingridient_name': 'сыр', 'quantity': 20, 'measure': 'гр'}, {'ingridient_name': 'колбаса', 'quantity': 30, 'measure': 'гр'}, {'ingridient_name': 'бекон', 'quantity': 30, 'measure': 'гр'}, {'ingridient_name': 'оливки', 'quantity': 10, 'measure': 'гр'}, ], 'лимонад': [ {'ingridient_name': 'лимон', 'quantity': 1, 'measure': 'шт'}, {'ingridient_name': 'вода', 'quantity': 200, 'measure': 'мл'}, {'ingridient_name': 'сахар', 'quantity': 10, 'measure': 'гр'}, {'ingridient_name': 'лайм', 'quantity': 20, 'measure': 'гр'}, ] } dish = input('Выберите блюдо: cалат, пицца, лимонад ') portions = int(input('Введите количество порций: ')) ingredients = cook_book[dish] for i in ingredients: for value in i.values(): print(value)

def dish(dish, portions): cook_book = { 'пицца': [ {'ingridient_name': 'сыр', 'quantity': 20, 'measure': 'гр'}, {'ingridient_name': 'колбаса', 'quantity': 30, 'measure': 'гр'}, {'ingridient_name': 'бекон', 'quantity': 30, 'measure': 'гр'}, {'ingridient_name': 'оливки', 'quantity': 10, 'measure': 'гр'}, ], 'лимонад': [ {'ingridient_name': 'лимон', 'quantity': 1, 'measure': 'шт'}, {'ingridient_name': 'вода', 'quantity': 200, 'measure': 'мл'}, {'ing

Questions about programming?Chat with your personal AI assistant