Let's do some magic Quiz on Python!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Let's do some magic Quiz on Python!!

I couldn't figure it out (yes I'm a noob) But even when i took a look at the solution it still didn't pass so i improvised a little #their solution: items = int(input()) days = int(input()) #your code goes here while days>0: items*=2 days-=1 print(items) #my solution: items = int(input()) days = int(input()) #your code goes here while days>0: items*=2 days-=1 if days > 0: continue print(items)

26th Jun 2022, 1:07 AM
Anouar Maazaz
Anouar Maazaz - avatar
3 Answers
+ 3
Anouar Maazaz Program is working fine but you need to print value outside the loop no need to use continue
26th Jun 2022, 5:34 AM
A͢J
A͢J - avatar
+ 1
Anouar Maazaz I already said print outside the while loop btw why use used continue? do you know why use continue?
26th Jun 2022, 12:31 PM
A͢J
A͢J - avatar
0
how can i print only the last value without using "continue"
26th Jun 2022, 10:46 AM
Anouar Maazaz
Anouar Maazaz - avatar