Write a program that calculates how many days it takes to accumulate at least $1,000,000 if someone deposits one penny on the first day, two pennies the second day, four pennies on the third day and continues to double each day. The output should display the number of days

Respuesta :

Answer:

Step-by-step explanation:

Let's do this in Python

day = 1

balance = 0

deposit = 0.01  # first deposit is 1 penny

while balance < 1000000: # execute the loop as long as balance is less than a million dollar

    balance += deposit

    deposit = deposit * 2 # double the deposit for the next time

    day += 1 # add one to day for the next day

print(day) # print out result once loop ends