In [3]:
# this is my penny doubler
def penny_doubler():
pennies = 1 # get one penny the first day
total_pennies = 0 # start off with 0
for day in range(31): # how many days we have til the doubler ends
day_earnings = pennies
total_pennies += day_earnings
dollars_today = day_earnings / 100 # each penny = 0.01
total_dollars = total_pennies / 100 # every dollar divides by 100 for the amount of pennies made
print(f"for day {day + 1} I made ${dollars_today:,.2f} for a total of ${total_dollars :,.2f}")
pennies *= 2 # This is for the doubling of pennies each day
In [4]:
penny_doubler()
for day 1 I made $0.01 for a total of $0.01 for day 2 I made $0.02 for a total of $0.03 for day 3 I made $0.04 for a total of $0.07 for day 4 I made $0.08 for a total of $0.15 for day 5 I made $0.16 for a total of $0.31 for day 6 I made $0.32 for a total of $0.63 for day 7 I made $0.64 for a total of $1.27 for day 8 I made $1.28 for a total of $2.55 for day 9 I made $2.56 for a total of $5.11 for day 10 I made $5.12 for a total of $10.23 for day 11 I made $10.24 for a total of $20.47 for day 12 I made $20.48 for a total of $40.95 for day 13 I made $40.96 for a total of $81.91 for day 14 I made $81.92 for a total of $163.83 for day 15 I made $163.84 for a total of $327.67 for day 16 I made $327.68 for a total of $655.35 for day 17 I made $655.36 for a total of $1,310.71 for day 18 I made $1,310.72 for a total of $2,621.43 for day 19 I made $2,621.44 for a total of $5,242.87 for day 20 I made $5,242.88 for a total of $10,485.75 for day 21 I made $10,485.76 for a total of $20,971.51 for day 22 I made $20,971.52 for a total of $41,943.03 for day 23 I made $41,943.04 for a total of $83,886.07 for day 24 I made $83,886.08 for a total of $167,772.15 for day 25 I made $167,772.16 for a total of $335,544.31 for day 26 I made $335,544.32 for a total of $671,088.63 for day 27 I made $671,088.64 for a total of $1,342,177.27 for day 28 I made $1,342,177.28 for a total of $2,684,354.55 for day 29 I made $2,684,354.56 for a total of $5,368,709.11 for day 30 I made $5,368,709.12 for a total of $10,737,418.23 for day 31 I made $10,737,418.24 for a total of $21,474,836.47
In [ ]: