What is the purpose of the else clause in a Python loop?

  • To define loop initialization
  • To execute code after the loop completes without a break
  • To handle exceptions
  • To specify an alternate loop condition
The else clause in a Python loop is used to execute code after the loop completes without a break statement being encountered.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *