-
-
Save trainingcity/b6513ec1c116a61c4287a3187bce4bb8 to your computer and use it in GitHub Desktop.
Дан список цен на пять товаров с точностью до копейки. Так как экономика даёт о себе знать, мы спрогнозировали, что через год придётся повышать цены на X процентов, а ещё через один год — ещё на Y процентов.Напишите программу, которая получает на вход список цен на товары (вещественные числа, список генерируется также с помощью list comprehensio…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def level_up_price(new_price, product_old): | |
return product_old * (1 + new_price / 100) | |
quantity_product = int(input('Кол-во товаров: ')) | |
list_product = [] | |
for i_product in range(1, quantity_product + 1): | |
product = float(input('Цена на продукт: ')) | |
list_product.append(product) | |
first_up_price = int(input('Повышение цен в первый год в %: ')) | |
last_up_price = int(input('Повышение цен во второй год в %: ')) | |
first_list_up_product = [level_up_price(first_up_price, up_price) for up_price in list_product] | |
last_list_up_product = [level_up_price(last_up_price, up_price) for up_price in list_product] | |
print(f'Сумма цен за каждый год на один и тож же прайс: {sum(list_product):.2f}, {sum(first_list_up_product):.2f}, {sum(last_list_up_product):.2f}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment