products = [
{"name": "Ручка", "quantity": 30},
{"name": "Тетрадь", "quantity": 80},
{"name": "Карандаш", "quantity": 120},
]
def calculate_discount(quantity):
if quantity <= 50:
return 0
elif quantity <= 100:
return 0.02
else:
return 0.05
print("Примерный план закупок:")
for product in products:
print(f"{product['name']}: {product['quantity']} шт.")
print("\nРезультаты:")
for product in products:
discount = calculate_discount(product["quantity"])
discounted_price = (1 - discount) * product["quantity"]
print(f"{product['name']}: Скидка {discount * 100}%, Цена со скидкой: {discounted_price:.2f}")