Choose

Report a typo

Which while loop will produce this output:

1
3
5
7
9

The options:

a)

i = 0
while i < 10:
    print(i)
    i += 1

b)

i = 1
while i < 10:
    print(i)
    i += 2

c)

i = 1
while i > 0:
    if i % 2 == 1:
         print(i)
    i += 2

d)

i = 0
while i != 10:
    if i % 2 != 0:
        print(i)
    i += 2
Select one option from the list
___

Create a free account to access the full topic