28th Oct 2020, 3:02 PM
Sindhuja Selvakumar
Sindhuja Selvakumar - avatar
5 Answers
+ 6
Sindhuja Selvakumar , if you want to skip even numbers, you have to do this in the for loop, because ouside a loop you can not use break or continue.
28th Oct 2020, 3:26 PM
Lothar
Lothar - avatar
+ 2
What you trying with 1st if statement? You can use break in loop to break loops but you are using outside loop..
28th Oct 2020, 3:04 PM
Jayakrishna 🇼🇳
+ 2
Move to inside loop like this but use continue instead break. Using 'break' cause to come out of loop while using 'continue ' cause to continue with next iteration.. n = int(input()) for sololearn in range(n): if sololearn % 2 == 0: continue if sololearn % 3 == 0 and sololearn % 5 == 0: print("sololearn") continue elif sololearn % 3 == 0: print("solo") continue elif sololearn % 5 == 0: print("learn") continue print(sololearn)
28th Oct 2020, 3:44 PM
Jayakrishna 🇼🇳
0
Iam trying to skip the even numbers in the list
28th Oct 2020, 3:06 PM
Sindhuja Selvakumar
Sindhuja Selvakumar - avatar
0
Tq soo much😊
28th Oct 2020, 4:15 PM
Sindhuja Selvakumar
Sindhuja Selvakumar - avatar