Problem 150387 · easy · Phase 01 Prerequisites & Setup

Loan Decision

conditionals · boolean logic · arithmetic

A bank decides on a loan application from the applicant's credit score, their monthly income and the monthly payment the loan would need. Write loan_decision(credit_score, monthly_income, monthly_payment):

  • "approved" if the score is at least 700 and income is at least 3 times the payment
  • "approved with conditions" if the score is at least 600 and income is at least 4 times the payment
  • "denied" otherwise

Examples

Input:  credit_score = 720, monthly_income = 6000, monthly_payment = 1500
Output: "approved"

Input:  credit_score = 650, monthly_income = 8000, monthly_payment = 1500
Output: "approved with conditions"

Input:  credit_score = 720, monthly_income = 4000, monthly_payment = 1500
Output: "denied"

Constraints

  • 300 <= credit_score <= 850
  • 0 <= monthly_income, monthly_payment <= 10**6

Goals

  • Combine a threshold on one value with a ratio between two others
  • Fall through tiers from the best offer to a refusal
Starting Python…