last lab
This commit is contained in:
21
labPython/lab5/Slov14.py
Executable file
21
labPython/lab5/Slov14.py
Executable file
@@ -0,0 +1,21 @@
|
||||
candies = {
|
||||
"Шоколадные": {"price": 150, "shelf_life": "12 месяцев", "shops": [1, 3, 5]},
|
||||
"Карамель": {"price": 80, "shelf_life": "6 месяцев", "shops": [2, 4]},
|
||||
"Трюфели": {"price": 150, "shelf_life": "18 месяцев", "shops": [1, 2, 3]},
|
||||
"Мармелад": {"price": 120, "shelf_life": "9 месяцев", "shops": [2, 5]},
|
||||
"Ириски": {"price": 950, "shelf_life": "8 месяцев", "shops": [1, 3, 4]},
|
||||
"Вафли": {"price": 1800, "shelf_life": "10 месяцев", "shops": [3, 4, 5]},
|
||||
"Пряники": {"price": 110, "shelf_life": "7 месяцев", "shops": [1, 2]}
|
||||
}
|
||||
|
||||
for name, info in candies.items():
|
||||
if 100 <= info["price"] <= 200:
|
||||
print(f"{name}:")
|
||||
print(f" Срок годности: {info['shelf_life']}")
|
||||
shops_str = ""
|
||||
for i in range(len(info['shops'])):
|
||||
if i > 0:
|
||||
shops_str += ", "
|
||||
shops_str += str(info['shops'][i])
|
||||
print(f" Магазины: {shops_str}")
|
||||
|
||||
Reference in New Issue
Block a user