0
Having trouble
Specific Question 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. Not sure what to multiply.
21 Antworten
+ 3
always read the task carefully. sometimes there you can find a hint of its solution
+ 3
Finally after some research solved it. Thank you so much for your help what i was doing wrong was print (500*2^24) when in fact code for 2^24 is written out 2**24. So the answer was print (500*2**24)
+ 2
Thank you so much, id still be stuck if you didnt help
+ 1
Or you can use pow function:
pow(3, 2) # output 9 -> 3²
pow(10, 3) # output 1000 -> 10³
+ 1
#Soution -
bact = 500
for num in range(1,25):
bact = bact*2
print(bact)
+ 1
THANK YOU ALL
0
What language?
Simply you can create a loop of 24 hr
And set the following logic
Initial = 500
Inital = Intial * 2 ( mutilation of initial by 2 after updating inital for 24 times )
0
Hi! Can you show us your code attempt? Thx!
0
I am entirely new to code, the language is python.
0
make a try and write at least some code. how can we help you without seeing the code?
0
in the task itself, at the bottom, in the yellow field, you are even given a hint on which formula to use for this. just write it using python and display the result on the screen. where did you stumble?
0
The example given is (500 *2n) in python i wrote out print (500*2) and i get the results to 500*2 i dont know where to go from here. Im not sure what exactly they want me to multiply.
0
500*2 -> this is the progress of bacterial growth in one hour. and in the task, how many hours are you asked to count the bacteria?
0
24 hours
0
Right! And now insert this number to given formula: 500*2N, where N - number of hours. two to the power of the number of hours
0
So 500 times 2 to the 24 power
0
yes, you just had to repeat the lesson of exponentiation and remember how this operator looks in python
0
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.
- 1
its too easy use this u can get your output
print(500*2**24)
- 1
bact = 500
for num in range(1,25):
bact = bact*2
print(bact)