+ 1

How can I code this

Exponentiation is the raising of one number to the power of another. This operation is performed using two asterisks **. Let's use exponentiation to solve a known problem. You are offered a choice of either $1.000.000 or $0.01 (one penny) doubled every day for 30 days (the resulting amount is doubled every day). Task: Write a program to calculate the amount that will result from the doubling to understand which choice results in a larger amount. Hint: Let's see how exponentiation can be useful to perform the calculation. For example, if we want to calculate how much money we will have on the 5th day, we can use this expression: 0.01*(2**5) = 0.32 dollars (multiply the penny by 2 raised to the power of 5).

3rd Aug 2022, 11:46 PM
Keroles GHatass
4 Answers
+ 3
The answer is giving in the example. print(0.01*(2**5)) But instead of to the power of 5 for 5 days. You want to the power of 30 for 30 days.
4th Aug 2022, 3:48 AM
Chris Coder
Chris Coder - avatar
+ 1
Oh yea no doubt this lesson you are referring to makes no sense at all. I did solve it by trial and error. Cant remember exactly but just keep referring to the expected output and hack it (basically). I think its a bug because I was not able to understand it ever.
4th Aug 2022, 12:01 AM
ÏÒŻà«šĆ“dԌ૚ ×
ÏÒŻà«šĆ“dԌ૚ × - avatar
0
Aah that's right. I remember now.
4th Aug 2022, 4:08 AM
ÏÒŻà«šĆ“dԌ૚ ×
ÏÒŻà«šĆ“dԌ૚ × - avatar
0
print(0.01*(2**30))
5th Aug 2022, 4:43 PM
Godza
Godza - avatar