Last answered:

11 Jul 2023

Posted on:

06 Jul 2023

0

Using While Loops and Incrementing Exercise Problem

Hello, the exercize attached the aforementioned was to create a while loops that produced odd numbers under 30. In my solution to the aforementioned exercise I wrote:


x = 0

while x <30:

      print(x)


1 answers ( 0 marked as helpful)
Instructor
Posted on:

11 Jul 2023

0

Hi Alan!
Thanks for reaching out.


Please, use the following code:

x = 0

while x < 30:
    if x % 2 != 0:
        print(x, end=' ')
    x += 1


Hope this helps.
Best,
Tsvetelin

Submit an answer