0

Question about ā€˜continue’

So as i was typing a ā€˜continue’ program,here is what i typed- i = 0 while i<=10: i += 1 if i == 3: print("skipped") continue print(i) I got output from 1 to 11. I want it to stop at 10,is there any other way except using i<10,Or using Break to stop after reaching 10. Will rearranging this program lines in any way without any change work?

23rd Apr 2021, 10:35 AM
Ahnaf Inan
Ahnaf Inan - avatar
2 Answers
+ 4
replace "while i<=10:" with "while i<10:"
23rd Apr 2021, 10:42 AM
minirkk
minirkk - avatar
+ 1
Hello. Replace i=0 for i=1 and move i+=1 at the end of while (sorry by my english)
23rd Apr 2021, 10:56 AM
Luis Fabricio Tano
Luis Fabricio Tano - avatar