pyhton mcq 1

pyhton mcq

i = 1
while True:
    if i%3 == 0:
        break
    print(i)
 
    i + = 1

Here is what the above code is Doing:
1. We set i to 1.
2. We start a while loop that will run until the condition is met.
3. We check if i is divisible by 3.
4. If it is, we break out of the loop.
5. If it isn’t, we print i and add 1 to i.
6. We go back to step 3.

Similar Posts