In: Computer Science
100 bacteria cells are inoculated into a medium containing sufficient nutrients. Assuming it takes extactly one hour for any cell to divide. Write a program to calculate how many hours it takes for this cell population to reach a million cells. Use python please and get exact time value for 1,000,000 cells in while or if statement
code:
no_of_cells = 100 #initial count of bacteria cells
total_cells = 1000000 #final minimal count of bacteria cells
no_of_hours=0 #initial time no of hours is 0
while no_of_cells < total_cells: # loop will end no of cells
is greater or equal to 1 million
no_of_cells= no_of_cells*2 #for every hour bacterial count will
double and replace with new count
no_of_hours = no_of_hours +1 # increase no of hours
print("No of hours: ",no_of_hours) #print final no of
hours
print("Total cells: ",no_of_cells) # print final no of cells
screenshots: