And if the balance that the user gives us is negative the


initialBalance = float(input("Enter initial balance: "))

if initialBalance < 0:

  print ("ERROR: Please enter a positive balance. ")

else

print ("Balance", initialBalance)

sum = initialBalance

for i in range(1, 11):

  print (initialBalance * 0.05)

  sum += i

print(sum) 

Question: This is the code I have as of right now, I am trying to figure out a for loop that would, given two things: a balance and that interest rate of 5% is implemented every year for 10 year, to calculate and print the balance at the end of each year for 10 years. And if the balance that the user gives us is negative the program must give an error and tell them to enter a positive number.

Solution Preview :

Prepared by a verified Expert
Business Management: And if the balance that the user gives us is negative the
Reference No:- TGS02510534

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)