Question

1. Using Python write a function for compounding interest. There should be three arguments to the...

1. Using Python write a function for compounding interest. There should be three arguments to the function: a starting amount, a total interest rate, and the number of compounding periods. The function returns the ending value.

Notes: normally, interest rates are given per period, or annually. The total interest rate would be the per-period interest rate multiplied by the number of compounding periods. Or in your function, the per-period interest added is the total rate divided by the number of periods. If you take that simple concept (simple interest formula) and loop it by the number of periods, you can accumulate the ending amount. If you try to Google a formula for compound interest, it uses an exponent rather than a summation or loop, and it will be more difficult adapting it to work for the assignment (though it's possible).

Use your function to evaluate the following compounding interest scenarios:

a) Home Loan $300,000, 1.5 (150%), 30 yrs (this is equivalent to a 5% annual interest rate)

b) Credit Card $1000, 25% "APR" (0.25), compounding daily (365 times)

c) $1, 100% interest (1.0), compounding 12 times

d) $1, 100% interest (1.0), compounding 100 times

e) $1, 100% interest (1.0), compounding 999,999 times

0 0
Add a comment Improve this question Transcribed image text
Answer #1

HOPE THIS ANSWER SATISFIES YOUR QUERY. IF I MISSED SOMETHING PLEASE DO MENTION IN THE COMMENTS AND ALSO PLEASE RATE THE ANSWER. I HAVE ATTACHED SCREENSHOT ALSO FOR BETTER UNDERSTANDING OF THE CODE.
THANKS

def compounding(start, total_interest, periods):
interest = total_interest/periods #interest used for calculation is total interest divided by periods   
#print(interest)
A = start
for i in range(1,periods+1): #count for period starts from 1 till 30
A = A + (A * interest) #looped simple interest formula
print("Compound interest is", A)

compounding(300000,1.5,30)
compounding(1000,0.25,365)
compounding(1,1,12)
compounding(1,1,100)
compounding(1,1,999999)

​​​​​​​

Add a comment
Know the answer?
Add Answer to:
1. Using Python write a function for compounding interest. There should be three arguments to the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT