Bacteria | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Bacteria

A cell has 500 bacteria, for every hour it double in number, i.e 500x2=1000..... 1000x2=2000. Write a python program to output and calculate the number of bacteria there will be in 24 hours. Formula is 500*2^n Where is number for every hour

22nd Jul 2021, 6:40 PM
Eric Oma
Eric Oma - avatar
10 Answers
+ 3
Maybe i’d post the question again. I have no idea on how to go with the question itself
22nd Jul 2021, 6:47 PM
Eric Oma
Eric Oma - avatar
+ 3
# python print(500*2**int(input()))
22nd Jul 2021, 8:32 PM
Rohit Kh
Rohit Kh - avatar
+ 2
n is the number of hours. So for 24 hours, n = 24 formula is given Now Where's your attempt..?
22nd Jul 2021, 6:44 PM
Rohit Kh
Rohit Kh - avatar
22nd Jul 2021, 7:27 PM
Baribor Saturday
Baribor Saturday - avatar
+ 2
The Last Cherry Blossom The program is python sir
22nd Jul 2021, 8:17 PM
Eric Oma
Eric Oma - avatar
+ 1
Can you pls help with it. My knowlege for mathematics is not that lit
22nd Jul 2021, 6:51 PM
Eric Oma
Eric Oma - avatar
+ 1
import java.util.*; public class Program { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); System.out.println(500*Math.pow(2,n)); } } // everything was given to you, the only thing that was needed to be done was to convert maths formula into codes # python print(500*2**int(input()))
22nd Jul 2021, 6:55 PM
Rohit Kh
Rohit Kh - avatar
+ 1
✔✅Barry🔧 Can you pls elaborate
22nd Jul 2021, 8:16 PM
Eric Oma
Eric Oma - avatar
+ 1
#python print (500*2**24)
23rd Jul 2021, 6:49 PM
Vedika
0
✔✅Barry🔧 your code is not working. Check my comment on the matter. It keeps generating an error at line 7 sorry 🤔🤗
24th Jul 2021, 6:37 AM
🇺🇸 Anatoli🇧🇪🇪🇺 ,
🇺🇸 Anatoli🇧🇪🇪🇺 , - avatar