else Conditional Statement along with for Loop in Python:

In many of the programming languages, the use of else statement with for conditional statement has been restricted. But in the case of Python for Data Science, it is possible to use these two in a union.

Below we will be looking at two programs:

python for data science

In the first program, there is no break after for loop so, the else statement is executed. But in the second case, there is a break after for loop so, the else statement is not executed.

Below is another program that shows the role of if condition on else.

To learn more about else and for loop in python for data science, you can check this and this as well.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.