Advertisement
_takumi

qq

Mar 28th, 2023 (edited)
666
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. words = input()
  2. dc = {}
  3. while (words != "СТОП"):
  4.     lst = words.split(": ")
  5.     key = lst[0]
  6.     strs = lst[1].split(", ")
  7.     macros = []
  8.     for var in strs:
  9.         macros.append(int(var))
  10.     dc[key] = [macros, macros[0] * 4 + macros[1] * 9 + macros[2] * 4]
  11.     words = input()
  12.    
  13. prods = input().split(", ")
  14. strings = {}
  15. for prod in prods:
  16.     keyval = prod.split('-')
  17.     key = keyval[0]
  18.     val = int(keyval[1])
  19.     strings[dc[key][0][1]] = "Продукт: {0}, калорийность: {1}".format(key, str(dc[key][1] * val))
  20. dict1 = OrderedDict(sorted(strings.items()))
  21. for var1, var2 in dict1:
  22.     print(var2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement