Q. There are two types of else clauses in Python. What are these two types of else clauses?
Answer =
The two types of Python else clauses are:
(a) else in an if statement :- The else clause of an if statement is executed when the condition of the if statement results into false.
(b) else in a loop statement :- The else clause of a loop is executed when the loop is terminating normally i.e., when its test-condition has gone false for a while loop or when the for loop has executed for the last value in sequence.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )