Python - While Loop
Which of the following is the correct syntax to stop a while True loop when a variable count reaches 5?
count = 0
while True:
count += 1
?Which of the following is the correct syntax to stop a while True loop when a variable count reaches 5?
count = 0
while True:
count += 1
?== to compare values, so if count == 5 is correct.break to exit the loopbreak statement stops the loop immediately when the condition is true.== and break to stop loop [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions