0

Make changes in the code so that it prints values<10 but not value 10, WITHOUT changing the test condition of while loop

The code is: i=0 while i<10: i+=1 if i%2==0: print(i)

7th Jan 2020, 4:50 AM
Lalit kumar
Lalit kumar - avatar
2 RĂ©ponses
+ 1
Try this bro: i=0 while i<10: i+=1 if i== 10: continue if i%2==0: print(i)
7th Jan 2020, 5:27 AM
Thống Nguyễn
Thống Nguyễn - avatar
0
Or more simple way: i=0 while i<10: if i%2==0: print(i) i = i + 2
7th Jan 2020, 5:33 AM
Thống Nguyễn
Thống Nguyễn - avatar