+ 2
Program outputs twice
items = int(input()) days = int(input()) i = 1 while i <= days: d = items * 2 ** days i +=1 print(d) Why does this program output twice? For example when you put 3 and 2 it outputs 12 and 12 in the next line
3 ответов
+ 3
It's output twice or multiple time because you have putted the print statement inside the while loop and whatever the days value is putted by user it will print the result till that time. If you want to take print statement one time than print outside the loop
items = int(input())
days = int(input())
i = 1
while i <= days:
d = items * 2 ** days
i +=1
print(d)
+ 2
No problem it happens :>
0
Thank you bro I was a little blind hahah