Can you please tell me why it does not run? I get no errors but when i try to run it it just has the restart program loc

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Can you please tell me why it does not run? I get no errors but when i try to run it it just has the restart program loc

Post by answerhappygod »

Can you please tell me why it does not run? I get no errors but
when i try to run it it just has the restart program location line
every time. Any help is appreciated.
def get_prin_amt():
prin_amt = int(input('Please enter valid principal amount'))
if prin_amt >=0:
# Return the valid principal
return prin_amt()
else:
print('Please enter valid principal')
return get_prin_amt()
def get_prd():
prd = int(input('Please enter valid time period in months'))
if prd >=0 and prd <=48:
return prd
else:
print('Please enter valid time period')
return get_prd()
def get_int_rate():
int_rate = int(input('Please enter valid interest rate'))
#Data validation
if int_rate >=0 and int_rate >=16:
#return valid interest rate
return int_rate
else:
print('Please enter valid interest rate')
return int_rate
def get_loanCoast(principal, period, int_rate):
payment = (int_rate/(1-(1+int_rate)**(prd)))*prin
loanCoast = prin - prd * payment
return payment, loanCost
print('For loan 1')
prin,prd,int_rate =0,0,0
prin = get_prin_amt()
prd = get_prd()
int_rate = get_int_rate()
payment1,cost1 = get_loanCost(prin_amt, prd, int_rate)
#Function to calculate cost
print('Loan 1 payment = {}'.format(payment1))
#Print payment and cost of loan 1
print('Loan 1 Cost = {}'.format(cost1))
print('Loan 2')
prin = get_prin_amt()
prd = get_prd()
int_rate = get_int_rate
payment2,cost2 = get_loanCost(prin, prd, int_rate)
print('Loan 2 payment = {}'.format(cost2))
print('Sum of Cost of two loans = {}'.format(cost1 + cost2))
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply