Python Programming - Loops - Discussion

Discussion Forum : Loops - General Questions (Q.No. 11)
11.
What does the else block in a for loop execute when the loop completes without encountering a break statement?
It is executed when the loop condition is True.
It is executed when the loop is terminated prematurely.
It is executed only if an exception occurs in the loop.
It is executed when the loop completes its iterations normally.
Answer: Option
Explanation:
The else block in a for loop is executed when the loop completes its iterations normally, without encountering a break statement.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.