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

9th Jun 2024, 4:28 PM
Nay Say
Nay Say - avatar
17 Respuestas
+ 5
1. Double the cells 2. Print the output 3. Increase counter Compare to the example output.
9th Jun 2024, 4:45 PM
Lisa
Lisa - avatar
+ 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...
9th Jun 2024, 6:55 PM
Lothar
Lothar - avatar
+ 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
9th Jun 2024, 4:42 PM
Junior
Junior - avatar
+ 3
Read my comment carefully. You are doing 1. print 2. double 3. increase
9th Jun 2024, 7:06 PM
Lisa
Lisa - avatar
+ 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
9th Jun 2024, 7:21 PM
Nay Say
Nay Say - avatar
+ 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.
9th Jun 2024, 7:01 PM
Lothar
Lothar - avatar
+ 2
you should 1. Double the cells 2. Print the output 3. Increase counter
9th Jun 2024, 7:10 PM
Lisa
Lisa - avatar
+ 2
yes, look at the order
9th Jun 2024, 7:11 PM
Lisa
Lisa - avatar
+ 2
Thank you so much…. And thanks everyone for helping
9th Jun 2024, 7:21 PM
Nay Say
Nay Say - avatar
+ 2
Dorian Martinez , are you sure that your suggestions are working properly?
11th Jun 2024, 5:53 AM
Lothar
Lothar - avatar
+ 1
Haha now reading again i forgot to mention about the order on the opperation. Thanks you.
11th Jun 2024, 6:30 AM
Dorian Martinez
Dorian Martinez - avatar
0
Yes thats what i got
9th Jun 2024, 6:58 PM
Nay Say
Nay Say - avatar
0
Am i missing something?
9th Jun 2024, 7:03 PM
Nay Say
Nay Say - avatar
0
What should i do ?
9th Jun 2024, 7:06 PM
Nay Say
Nay Say - avatar
0
Im order?
9th Jun 2024, 7:10 PM
Nay Say
Nay Say - avatar
0
In
9th Jun 2024, 7:10 PM
Nay Say
Nay Say - avatar
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.
11th Jun 2024, 3:24 AM
Dorian Martinez
Dorian Martinez - avatar