How to calculate exponention | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to calculate exponention

Did you know that there are more bacteria cells in your body than cells that make up your body? Weird! A bacteria culture starts with 500 bacteria and doubles in size every hour. Which means, after 1 hour the number of bacteria is 1000, after 2 hours - 2000, and so on. Let’s calculate and output the number of bacteria that will be in the culture after 24 hours

16th Feb 2022, 10:40 AM
nilesh kumar
nilesh kumar - avatar
5 Answers
- 2
PRINT(500*2**24) BACTERIA DOUBLE EVERY HOURS SO = 500*2 ,AND THE IT IS HAPPEING FOR 24 HOUR S0=500*2**24 FINAL STEP=PRINT(500*2**24)
16th Feb 2022, 11:03 AM
ABHINAV RAJ SINGH
ABHINAV RAJ SINGH - avatar
+ 5
Exponentiation is explained in lesson 5 of the Python for Beginners course. Re-read the lesson
16th Feb 2022, 11:17 AM
Lisa
Lisa - avatar
+ 2
Power calculation need is 2**24, =>2 power 24 here ** is 'power of' operator in python. hope it helps in complete task.
16th Feb 2022, 11:05 AM
Jayakrishna 🇮🇳
+ 1
Thanks a lot friends
16th Feb 2022, 11:36 AM
nilesh kumar
nilesh kumar - avatar
+ 1
You can use ** operator, but be aware with its predence, exponent operator has right to left associativity
16th Feb 2022, 7:26 PM
Hermawan Sentyaki Sarjito
Hermawan Sentyaki Sarjito - avatar