write an algorithm to settle the following question: a bank account starts out with $10,000. interest is compounded monthly at 6 percent per year (0.5 percent per month). every month, $500 is withdrawn to meet college expenses. after how many years is the account depleted?

Sagot :

Using the knowledge in computational language in python it is possible to write a code that write an algorithm to settle the following question.

Writting the code:

original = float(raw_input("Enter initial balance: "))

interest = float(raw_input("Enter promised return: "))

expenses = float(raw_input("Enter monthly expenses: "))

interest = interest / 100 / 12

month = 0

balance = original

if balance * interest - expenses >= 0:

print "You don't need to worry."

else:

while balance + balance * interest - expenses >= 0: # negation of the if condition

balance = balance + interest * balance # in one month

balance = balance - expenses

month = month + 1

print month, balance

print month / 12, "years and", month % 12, "months"

See  more about python at brainly.com/question/18502436

#SPJ1

View image Lhmarianateixeira