0

Why does this code print 11 as well?

count = 0 while count <= 10: count = count + 1 if count % 2 == 0: continue print(count) #output: 1 3 5 7 9 11

10th May 2020, 10:04 AM
Einstein Shilly shally
Einstein Shilly shally - avatar
1 Answer
+ 1
Because it loops as long as count is not greater than 10 and then increases count before printing. So you enter with 10 and print 10+1.
10th May 2020, 10:05 AM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar