- 2

Python

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. My code is: items = int(input()) days = int(input()) i = 1 x = days while i <= x: items *= 2 i = i + 1; print(items)

18th Sep 2021, 8:13 PM
Nida Hanfi
Nida Hanfi - avatar
5 odpowiedzi
+ 2
Nida Hanfi Do you have a concept for us to look at, else it sounds like you want us to do your homework. Please attach a code attempt so we may guide you
18th Sep 2021, 9:00 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Please, firstly show your attempt. After that ask what your problem is clearly. Thanks for understanding. Happy coding!
18th Sep 2021, 9:33 PM
mesarthim
mesarthim - avatar
0
i am sorry I posted my code can you please guide me as I am stuck on this Question if you know Please
19th Sep 2021, 7:44 PM
Nida Hanfi
Nida Hanfi - avatar
0
Nida Hanfi Try this items = int(input()) days = int(input()) while days > 1: items *= 2 days -=1; print(items) if you put in 2 items for 3 days day 2 -> 4 items day 3 -> 8 items 10 items for 4 days day 2 -> 20 day 3 -> 40 day 4 -> 80
19th Sep 2021, 9:23 PM
Rik Wittkopp
Rik Wittkopp - avatar