I need to solve a problem in a Python milking beginners course.
You are offered a one-time payment of $1,000,000 or 1 cent, which doubles every day for 30 days (the amount received doubles every day).
Write a program to calculate the amount obtained by doubling to determine in which case the amount is greater.
My attempts:
i = 0.01
for i in range(31):
day = i
day_1 = day * (2 ** 2)
print(i)
I don't know how to tell the program to calculate the amount for each day until the 30th, except to specify it for each day separately - but then you get a very long code (one line for each day), I think there should be a command that does it faster.
i = 0.01
for i in range(31):
day = i
day_1 = day * (2 ** 2)
print(i)
You can use this code:
This code will have a start value, and set a temp variables value to the start. For every day in the 30 days, it will double the value in the temp value, and then print the final total amount when done.