How many lines will the following code print?
How many lines will the following code print?
The code first sets x to 0. It then enters a while True loop where x is incremented by 1, making it 1. The code checks if x is less than 100, which is true, so it prints '1<100' and then executes the break statement, which exits the loop. Only one line is printed before the break statement is executed, so the answer is 1.
line 5 needs paranthesis
X starts at 0. Enters while loop, X = 1, first if statement executes, and 1 line is produced, then the break statement ends the loop
non parenthesis so the code would crash after if x < 200:
When running this code, line 5 is identified as a syntax error. Therefore, it returns 0 lines. I did not try this in Python 2.
Try py 2