I cant answer exponentiation | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
- 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

11th Apr 2021, 8:58 PM
Eros Blue Prince ūüíô
Eros Blue Prince ūüíô - avatar
8 Respuestas
+ 2
Before you consider solve the problem with Python, you have to understand how to solve it mathematically. Can you solve it mathematically?
11th Apr 2021, 9:06 PM
Per Bratthammar
Per Bratthammar - avatar
+ 2
Yes Per i understand it Thx
11th Apr 2021, 9:43 PM
Eros Blue Prince ūüíô
Eros Blue Prince ūüíô - avatar
+ 2
a=1000*(2**30) b=0.01*(2**30) if a > b: print(b) else: print(a)
17th Feb 2022, 12:27 PM
Chen Lyneing
Chen Lyneing - avatar
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.
11th Apr 2021, 9:07 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
I cant answer two cases at the same time
11th Apr 2021, 10:05 PM
Eros Blue Prince ūüíô
Eros Blue Prince ūüíô - avatar
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.“)
11th Apr 2021, 11:29 PM
Per Bratthammar
Per Bratthammar - avatar
0
Obviously I missunderstood you. So what do you mean with ‚ÄúI cant answer two cases at the same time‚ÄĚ?
12th Apr 2021, 4:26 AM
Per Bratthammar
Per Bratthammar - avatar
- 1
First solve the problem mathematically, then implement it.
12th Apr 2021, 12:12 PM
Ant√īnio Gabriel Zeni Landim
Ant√īnio Gabriel Zeni Landim - avatar