**New course!**Every coder should learn

**Generative AI!**

- 6

# I cant answer exponentiation

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). I dont understand

8 Answers

+ 2

Before you consider solve the problem with Python, you have to understand how to solve it mathematically. Can you solve it mathematically?

+ 2

Yes Per i understand it
Thx

+ 2

a=1000*(2**30)
b=0.01*(2**30)
if a > b:
print(b)
else:
print(a)

0

you either chose 1,000,000 or (0.01×2^30), so after 30 days this amount becomes 10,737,418.24. the second choice is better.

0

I cant answer two cases at the same time

0

Thats about mathematical relations:
if Case_A > Case_B:
print(“Case_A is better “)
elif Case_A < Case_B:
print(“Case_B is better“)
else:
print(“Case_A and Case_B are equal.“)

0

Obviously I missunderstood you. So what do you mean with “I cant answer two cases at the same time”?

- 1

First solve the problem mathematically, then implement it.