+ 1

I think this has wrong answer?

for i in range(10): if not i%2 == 0: print(i) The answer here is that it will print all even numbers between 2 and 10 but actually it prints odd numbers between 1 to 9.

22nd May 2019, 12:29 PM
Manav Sharma
Manav Sharma - avatar
2 Antworten
+ 2
basically, i%2 == 0 - all even numbers not i%2 == 0 - tries to find numbers that are NOT even.
22nd May 2019, 1:17 PM
Choe
Choe - avatar