- 2

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

30th Nov 2020, 1:48 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
17 Réponses
+ 4
SANNI ABDUL-AMEEN OLUWADARASIMI you are cheking for parity in a seperate loop, how do you expect it to work ? Here is the fix👇 https://code.sololearn.com/c2nKcLNIkZ27/?ref=app
30th Nov 2020, 2:12 AM
Arsenic
Arsenic - avatar
+ 3
if number % 2 == 0: continue
1st Dec 2020, 9:41 AM
Bishow Pandey
Bishow Pandey - avatar
+ 2
Thanks
30th Nov 2020, 2:13 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
+ 1
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)
30th Nov 2020, 3:24 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Thank you
1st Dec 2020, 3:08 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
+ 1
Use continue for even condition
1st Dec 2020, 6:53 AM
Gaurav Misra
Gaurav Misra - avatar
0
It didn't work
30th Nov 2020, 1:57 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
I have tried it before
30th Nov 2020, 1:57 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
This was my code for x in range(1,n) if x % 2 == 0: continue
30th Nov 2020, 1:58 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
And I also tried break,none worked
30th Nov 2020, 1:58 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
30th Nov 2020, 2:06 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
Yes,but I used continue instead of pass
30th Nov 2020, 2:12 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
And all didn't work
30th Nov 2020, 2:12 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
Steven M,your code is wrong
30th Nov 2020, 2:17 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
Check Arsenic's
30th Nov 2020, 2:17 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
I almost got it,just a little bug
30th Nov 2020, 2:17 AM
SANNI ABDUL-AMEEN OLUWADARASIMI
0
It doesn't,enter 15 and see the results
30th Nov 2020, 2:22 AM
SANNI ABDUL-AMEEN OLUWADARASIMI