How can I avoid printing the even numbers in a python code,I'm in project 3,fizzy bus and I'm stuck | SoloLearn: Learn to code for FREE!

0

How can I avoid printing the even numbers in a python code,I'm in project 3,fizzy bus and I'm stuck

How do I solve it

11/30/2020 1:48:59 AM

SANNI ABDUL-AMEEN OLUWADARASIMI

17 Answers

New Answer

+3

SANNI ABDUL-AMEEN OLUWADARASIMI you are cheking for parity in a seperate loop, how do you expect it wo work ? Here is the fix👇 https://code.sololearn.com/c2nKcLNIkZ27/?ref=app

+2

+2

Try setting your range to skip the even numbers, then iterate. n = int(input()) for x in range(1, n, 2): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") else: print(x)

+2

Use continue for even condition

+2

if number % 2 == 0: continue

+1

0

0

I have tried it before

0

This was my code for x in range(1,n) if x % 2 == 0: continue

0

And I also tried break,none worked

0

https://code.sololearn.com/cAd1BKVNIQrq/?ref=app

0

Yes,but I used continue instead of pass

0

0

Steven M,your code is wrong

0

0

I almost got it,just a little bug

0

It doesn't,enter 15 and see the results