+ 2

I don't understand

What does this code do? for i in range(10): if not i % 2 == 0: print(i+1) ----- ------ ------ can anyone explain it

4th Mar 2018, 10:43 AM
Arshan Khan
Arshan Khan - avatar
3 odpowiedzi
+ 12
loop will run from 0 to 9 ... , condition true for 1,3,5,7,9 //so output will be 2,4,6,8,10 as we are printing these above numbers by adding 1 to them
4th Mar 2018, 11:36 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 9
print: 2, 4, 6, 8, 10
4th Mar 2018, 10:47 AM
Vukan
Vukan - avatar