Library
Exercises
Games
Exams
Resources
Forum
News
Light
Log in
Sign up
Library
Exercises
Games
Exams
Resources
Forum
News
All courses
Library
Variables, loops and conditions
Infinite loop
MCQ
Why does the following code cause an infinite loop?
x = 1 while x < 5: print(x)
Possible answers
Because the variable x is never modified in the loop, so the condition x < 5 always stays true
Because the print function cannot be used in a while loop
Because the condition x < 5 is false from the start
Because an elif is missing after the while
Log in to reply
Previous
Exercise 3 of 4
Next exercise
Report a mistake or suggest an improvement