+ 1

Still i am facing problem with continue and break loops...why this happens...can anyone plz clear me

x=input() for y in range(x): if y ==5: print(y) if y>=6: continue print(y) print(y)

4th Oct 2020, 1:35 PM
Muhtasinul
Muhtasinul - avatar
2 odpowiedzi
+ 1
Let the value of x = 8 for y in range(8): #means the numbers from 0:7 if y ==5: Out put 5 if y >=6 : continue #means if y = 6,7 as the range of x =8 which means the greatest number is 7 then the following sentence print(y) ====> will output 7 The last sentence which exist out the for loop will output 7 Remark : the second if ststement should be inside the loop
4th Oct 2020, 1:47 PM
Muhammad Galhoum
Muhammad Galhoum - avatar
0
could u please fix the identation so that we can read the code clearly
4th Oct 2020, 1:46 PM
durian
durian - avatar