Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
Python3-Q2
Why this code: for i in range(10): if not i % 2 == 0: print(i+1) it has this output?
3 Antworten
+ 5
The if statement is true for odd numbers as i%2 == 0 is true for evens and not false is true. The print adds one to i so will be display the next higher even.
+ 4
What output?
amirhossein jamazari please sate the output.
0
output is
2
4
6
8
10