|
| 1 | +#lex_auth_012693788748742656146 |
| 2 | + |
| 3 | +def calculate_loan(account_number,salary,account_balance,loan_type,loan_amount_expected,customer_emi_expected): |
| 4 | +eligible_loan_amount=0 |
| 5 | +bank_emi_expected=0 |
| 6 | +eligible_loan_amount=0 |
| 7 | +#Start writing your code here |
| 8 | +if(account_number>999 and account_number<2000): |
| 9 | +if(account_balance>=100000): |
| 10 | +if(salary>25000 and loan_type=="Car"): |
| 11 | +eligible_loan_amount=500000 |
| 12 | +bank_emi_expected=36 |
| 13 | +if(customer_emi_expected<=bank_emi_expected and loan_amount_expected<=eligible_loan_amount): |
| 14 | +print("Account number:", account_number) |
| 15 | +print("The customer can avail the amount of Rs.", eligible_loan_amount) |
| 16 | +print("Eligible EMIs :", bank_emi_expected) |
| 17 | +print("Requested loan amount:", loan_amount_expected) |
| 18 | +print("Requested EMI's:",customer_emi_expected) |
| 19 | +else: |
| 20 | +print("The customer is not eligible for the loan") |
| 21 | +elif(salary>50000 and (loan_type=="Car" or loan_type=="House")): |
| 22 | +eligible_loan_amount=6000000 |
| 23 | +bank_emi_expected=60 |
| 24 | +if(customer_emi_expected<=bank_emi_expected and loan_amount_expected<=eligible_loan_amount): |
| 25 | +print("Account number:", account_number) |
| 26 | +print("The customer can avail the amount of Rs.", eligible_loan_amount) |
| 27 | +print("Eligible EMIs :", bank_emi_expected) |
| 28 | +print("Requested loan amount:", loan_amount_expected) |
| 29 | +print("Requested EMI's:",customer_emi_expected) |
| 30 | +else: |
| 31 | +print("The customer is not eligible for the loan") |
| 32 | +elif(salary>75000 and (loan_type=="Car" or loan_type=="House" or loan_type=="Business")): |
| 33 | +eligible_loan_amount=7500000 |
| 34 | +bank_emi_expected=84 |
| 35 | +if(customer_emi_expected<=bank_emi_expected and loan_amount_expected<=eligible_loan_amount): |
| 36 | +print("Account number:", account_number) |
| 37 | +print("The customer can avail the amount of Rs.", eligible_loan_amount) |
| 38 | +print("Eligible EMIs :", bank_emi_expected) |
| 39 | +print("Requested loan amount:", loan_amount_expected) |
| 40 | +print("Requested EMI's:",customer_emi_expected) |
| 41 | +else: |
| 42 | +print("The customer is not eligible for the loan") |
| 43 | +else: |
| 44 | +print("Invalid loan type or salary") |
| 45 | +else: |
| 46 | +print("Insufficient account balance") |
| 47 | +else: |
| 48 | +print("Invalid account number") |
| 49 | + |
| 50 | + |
| 51 | +#Use the below given print statements to display the output, in case of success |
| 52 | +#print("Account number:", account_number) |
| 53 | +#print("The customer can avail the amount of Rs.", eligible_loan_amount) |
| 54 | +#print("Eligible EMIs :", bank_emi_expected) |
| 55 | +#print("Requested loan amount:", loan_amount_expected) |
| 56 | +#print("Requested EMI's:",customer_emi_expected) |
| 57 | + |
| 58 | +#Use the below given print statements to display the output, in case of invalid data. |
| 59 | +#print("Insufficient account balance") |
| 60 | +#print("The customer is not eligible for the loan") |
| 61 | +#print("Invalid account number") |
| 62 | +#print("Invalid loan type or salary") |
| 63 | +# Also, do not modify the above print statements for verification to work |
| 64 | + |
| 65 | + |
| 66 | +#Test your code for different values and observe the results |
| 67 | +calculate_loan(1001,40000,250000,"Car",300000,30) |
0 commit comments