Why was my post wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why was my post wrong?

print((0.01*((2**30)-1))/(2-1)) result 10737418.23 not true. True result is 10737418.24. I don't know post image

2nd Jan 2021, 10:27 AM
Spiders 🕷 Man
Spiders 🕷 Man - avatar
5 Answers
+ 1
Spiders 🕷 Man This is the equation of geometric sequence right? An = A1*r**(n-1) Yes you are right. This is the original equation: print(0.01*(2**(31-1)) The reason why 31 is the last term is because the challenge is asking for the total cost AFTER 30 days which means the last term is 31. So it is the same anyway. And I think you placed the minus 1 outside the equation instead of the last term on your first code. I hope this helps.
2nd Jan 2021, 11:51 AM
noteve
noteve - avatar
+ 2
Try this: print(0.01*(2**30)) Update me if it still not working . If it works, allow me to explain. Thanks!
2nd Jan 2021, 10:36 AM
noteve
noteve - avatar
+ 2
1. In the challenge or problem, the exponent(30) represents the number of days so you dont need to Subtract 1 into it. 2. Divide by (2/1) is very unnecesary cause it will be equal to 1 or 1.0 anyway. (Any number that is divided by 1 will be the number itself as a result) 3. 2/1 == 1.0, this float number may be the reason why the answer is off by 1 decimal.
2nd Jan 2021, 10:53 AM
noteve
noteve - avatar
+ 2
I use A geometric series
2nd Jan 2021, 11:45 AM
Spiders 🕷 Man
Spiders 🕷 Man - avatar
+ 1
Thanks. Can you tell me Why was my post wrong?
2nd Jan 2021, 10:47 AM
Spiders 🕷 Man
Spiders 🕷 Man - avatar