Bacteria | Sololearn: Learn to code for FREE!

+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

7/22/2021 6:40:16 PM

Eric Oma

10 Answers

New Answer

+3

Maybe i’d post the question again. I have no idea on how to go with the question itself

+3

# python print(500*2**int(input()))

+2

n is the number of hours. So for 24 hours, n = 24 formula is given Now Where's your attempt..?

+2

https://code.sololearn.com/cIIc6T2WfeRB/?ref=app

+1

Can you pls help with it. My knowlege for mathematics is not that lit

+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()))

+1

✔✅Barry🔧 Can you pls elaborate

+1

The Last Cherry Blossom The program is python sir

+1

#python print (500*2**24)

0

✔✅Barry🔧 your code is not working. Check my comment on the matter. It keeps generating an error at line 7 sorry 🤔🤗