0

Confusing about continue within loops L24.1 of Python for beginner

The example in L24.1 of Python for beginner shows below, I can't understand why the output still contain "3" in it. Help, thanks! i = 1 while i<=5: print(i) i += 1 if i==3: print("Skipping 3") continue

11th Dec 2021, 3:56 PM
Charlie Tseng
1 Antwort
0
Your continue has no effect in loop as it is last statement to execute. Your if block is after it printing value so it not going to stop printing... edit: Charlie Check this : i = 1 while i<=5: i += 1 if i==3: print("Skipping 3") continue print(i)
11th Dec 2021, 4:06 PM
Jayakrishna 🇮🇳