Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def number_of_years(l, i):
- n = raw_input(' Enter your the number of years for the loan: ')
- try:
- n = float(n)
- if n > 0:
- print(' Loan amount is {0:.1f} \n'.format(l))
- print(' Interest rate is {0:.4f} \n'.format(i))
- print(' The number of years for the loan is {0:.1f} \n'.format(n))
- m = (l * (i / 100) * n + l) / (n * 12)
- print(' Your monthly payment is {0:.1f}'.format(m))
- else:
- print(' Error 0x666 ')
- number_of_years(l, i)
- except ValueError:
- print(' Error 0x666 ')
- number_of_years(l, i)
- def interest_rate(l):
- i = raw_input(' Enter your interest rate: ')
- try:
- i = float(i)
- if i > 0:
- print(' Loan amount is {0:.1f} \n'.format(l))
- print(' Interest rate is {0:.4f} \n'.format(i))
- number_of_years(l, i)
- else:
- print(' Error 0x666 ')
- interest_rate(l)
- except ValueError:
- print(' Error 0x666 ')
- interest_rate(l)
- def loan_amount(l):
- try:
- l = float(l)
- if l > 0:
- print(' Loan amount is {0:.1f} \n'.format(l))
- interest_rate(l)
- else:
- print(' Error 0x666 ')
- loan_amount()
- except ValueError:
- print(' Error 0x666 ')
- loan_amount()
- print(' Input "q" to quit ')
- while True:
- l = raw_input(' Enter your loan amount: ')
- if l == 'q':
- break
- loan_amount(l)
- continue
- print(' Thank you for using the app. ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement