0
Wat was the error?
6 Antworten
+ 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.
+ 2
What you trying with 1st if statement?
You can use break in loop to break loops but you are using outside loop..
+ 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)
0
Iam trying to skip the even numbers in the list
0
Tq soo much😊





