Can we use else with for loop in python?



Can we use else with for loop in python?..

Answer / Sumit Kudesia

No, Python does not support an 'else' clause within a 'for' loop. The 'else' statement in Python is used as part of conditional statements such as 'if', 'elif', and 'else'. It gets executed if the loop finishes naturally (i.e., without being terminated by a break statement).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is python web application framework?

1 Answers  


What is a repl in python?

1 Answers  


How does python compare string and int?

1 Answers  


What is python rest api?

1 Answers  


What is class inheritance in python?

1 Answers  


What is python distutils?

1 Answers  


What is self and init in python?

1 Answers  


What is python good for?

1 Answers  


What does len() do?

1 Answers  


What is slug in python?

1 Answers  


What is the use of the break statement?

1 Answers  


What’s your preferred text editor?

1 Answers  


Categories