0
What did I do wrong ??
# take the initial cell population as input cells = int(input()) # take the number of days as input days = int(input()) # initialize the day counter counter = 0 #complete the while loop while counter<=days : # Daily message print("Day " + str(counter) + ": " +str(cells)) counter += 1 cells *= 2
17 Respuestas
+ 5
1. Double the cells
2. Print the output
3. Increase counter
Compare to the example output.
+ 4
Nay Say ,
your result for the input of:
cells = 5
days = 3
is:
Day 0: 5
Day 1: 10
Day 2: 20
Day 3: 40
but should be:
Day 1: 10
Day 2: 20
Day 3: 40
> follow the instructions from lisa...
+ 3
Seems to work perfectly fine.
It would be better if you would describe the problem.
For now, I assume you are probably not entering the input correctly on sololearn. Every input should be serperated by a new line
+ 3
Read my comment carefully.
You are doing
1. print
2. double
3. increase
+ 3
# take the initial cell population as input
cells = int(input())
# take the number of days as input
days = int(input())
# initialize the day counter
counter = 1
#complete the while loop
while counter<=days :
cells *= 2
# Daily message
print("Day " + str(counter) + ": " +str(cells))
counter += 1
+ 2
Nay Say ,
this is the task description:
Imagine you are a scientist looking at a new type of cell under the microscope. This type of cell divides itself into 2 daughter cells every 24 hours, meaning that the cell population duplicates every day.
Task
Complete the code to take the initial cell population and the number of days you are observing the cells to calculate the cell population at the end of each day in the following format...
>> normally this should be **your task** to provide a proper description together with your question and codecsample.
+ 2
you should
1. Double the cells
2. Print the output
3. Increase counter
+ 2
yes, look at the order
+ 2
Thank you so much…. And thanks everyone for helping
+ 2
Dorian Martinez ,
are you sure that your suggestions are working properly?
+ 1
Haha now reading again i forgot to mention about the order on the opperation. Thanks you.
0
Yes thats what i got
0
Am i missing something?
0
What should i do ?
0
Im order?
0
In
0
Hi i was reading your code and its just a simple mistake. You should change your while loop comparison to a strict one. Should be while counter < days. Then on your output should do couter + 1. That way you have your cells output from 1 to the number of cells. Other solution would be to initialize your counter = 1. That should solve it. I hope it helped.