test
This commit is contained in:
31
task_34.py
Normal file
31
task_34.py
Normal file
@@ -0,0 +1,31 @@
|
||||
n = int(input("Введите количество банков: "))
|
||||
|
||||
deposits = []
|
||||
for i in range(n):
|
||||
data = input(f"Введите данные вклада {i + 1} (Банк Сумма Процент): ").split()
|
||||
deposit = {
|
||||
"bank": data[0],
|
||||
"amount": int(data[1]),
|
||||
"percent": float(data[2])
|
||||
}
|
||||
deposits.append(deposit)
|
||||
|
||||
most_affordable = deposits[0]
|
||||
for deposit in deposits:
|
||||
if deposit["amount"] < most_affordable["amount"]:
|
||||
most_affordable = deposit
|
||||
|
||||
print(f"\nСамый доступный банк: {most_affordable['bank']}")
|
||||
print(f"Начальная сумма: {most_affordable['amount']:.2f} руб.")
|
||||
|
||||
max_profit_deposit = deposits[0]
|
||||
max_profit = deposits[0]["amount"] * deposits[0]["percent"] / 100
|
||||
|
||||
for deposit in deposits:
|
||||
profit = deposit["amount"] * deposit["percent"] / 100
|
||||
if profit > max_profit:
|
||||
max_profit = profit
|
||||
max_profit_deposit = deposit
|
||||
|
||||
print(f"\nСамый выгодный банк: {max_profit_deposit['bank']}")
|
||||
print(f"Прибыль за год: {max_profit:.2f} руб.")
|
||||
Reference in New Issue
Block a user