0
Pls provide a answer to this question.While loops code coach question seems like itself a bug doesnt accept any answer
You have a magic box that doubles the count of items you put, in every day. The given program takes the initial count of the items and the number of days as input. Task Write a program to calculate and output items' count on the last day.
3 ответов
+ 2
So there is only one thing which can be changed in your code that is use print statement outside the while loop (without indentation/ or space)
Which will print only final answer
+ 3
I would suggest you to post your attempt... So that we can find issue in code.
btw this solution can be possible
i=1
while i<=days :
items = items*2
i=i+1
print(items)
0
while days>0:
items*=2
days-=1
print(items)
This is the code sol im writing yet shows wrong.
Your code solution is working same that it shows 1case right and other wrong.
Exitems input 3
days input 2
expected output-12
And my and your code answer contains
6
12
So the problem is we want just 12 in output not the 6