def calculate_credit(amount, years):
if amount < 10000: return "Отказ (Сумма)"
if amount > 1000000: return "Индивидуально (Сумма)"
if years > 10: return "Индивидуально (Срок)"
rate = 15
if 100001 <= amount <= 500000: rate -= 1
elif 500001 <= amount <= 1000000: rate -= 2
if 3 < years <= 5: rate += 1
elif 5 < years <= 10: rate += 2
total_payment = amount * (1 + rate / 100)
return f"{rate}% (Итого: {round(total_payment, 2)} руб.)"
def run_task_1():
print("ЗАДАНИЕ 1: МАТРИЦА ТЕСТОВ (СУММА x СРОК)")
amounts = [
(5000, "Меньше 10 000 руб."),
(50000, "10 000 - 100 000 руб."),
(250000, "100 001 - 500 000 руб."),
(750000, "500 001 - 1 000 000 руб."),
(1500000, "Более 1 000 001 руб.")
]
years = [(2, "до 3 лет"), (4, "3-5 лет"), (7, "5-10 лет"), (12, "более 10 лет")]
for am_val, am_text in amounts:
print(f"\nГРУППА: {am_text} | ТЕСТОВОЕ ЗНАЧЕНИЕ: {am_val} руб.")
print("-" * 70)
for yr_val, yr_text in years:
res = calculate_credit(am_val, yr_val)
print(f"Срок: {yr_text:12} (Значение: {yr_val:2}г.) | Результат: {res}")
print("\n" + "="*40)
print("РУЧНОЙ ТЕСТ")
try:
u_amount = float(input("Сумма: "))
u_years = float(input("Срок (лет): "))
print(f"Итог: {calculate_credit(u_amount, u_years)}")
except ValueError:
print("Ошибка ввода")
if __name__ == "__main__":
run_task_1()