Question

programming loop sample (Python) Problem 4.) Each month, Pytho puts $$100 into her bank account at...

programming loop sample (Python)

Problem 4.) Each month, Pytho puts $$100 into her bank account at the beginning of each month. Initially, she has $$100 in the account, marking her first deposit. At the end of each month, she earns 2% interest on her current balance, before the next deposit. Then, she makes her $$100 deposit. She would like a function that gives her balance after ?n months. Complete the function below so that the function returns the final balance. Keep in mind that ?=0t=0 corresponds to the initial month, when only one $$100 deposit has been made. Thus, she will have earned interest only on her initial $$100 deposit and she will have made one more deposit of $$100 at ?=1t=1 - that is, her balance should be $$202.

final_balance(360)

OUTPUT: 6357561.75

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def final_balance(n):
    total = 100
    for i in range(n):
        total *= 1.02
        total += 100
    return round(total, 2)


print(final_balance(360))

Add a comment
Know the answer?
Add Answer to:
programming loop sample (Python) Problem 4.) Each month, Pytho puts $$100 into her bank account at...
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