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: ТЕСТИРОВАНИЕ ГРУПП СУММ И СРОКОВ")
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}")
print("-" * 60)
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" + "="*30)
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()