KnowledgeBoat Logo

Computer Applications

What is the output of following code ?

while 3 >= 3 :
    print 3
  1. 3 is printed once
  2. 3 is printed three times
  3. 3 is printed infinitely until program is closed
  4. Error in code

Python Control Flow

3 Likes

Answer

3 is printed infinitely until program is closed

Reason — Since the given condition (3 >= 3) will always remain true, the while loop will execute indefinitely and keep on printing 3 on the output screen till the program is closed.

Answered By

2 Likes


Related Questions