Computer Science, asked by rinsha93, 11 months ago

what is the diffrence between else clause of if else and else clause of python loops in python?​

Answers

Answered by vicky9980
14

Explanation:

.The else of an if/else signifies the

start of a code block which will only

execute if the conditional (after the if

results in a False value.

.The else after loops signify the start

of a code block which is executed only

when the loop executes fully - i.e. there

is no break, or return or anything

else executed within the loop.

.The else after a try/except

signifies the start of a code block,

which is only executed if there is no

exception raised within the try block.

Answered by sukunatechnicalcolle
4

In Python 3 : The else of an if / else signifies the start of a code block which will only execute if the conditional (after the if ) results in a False value. ... The else after a try / except signifies the start of a code block, which is only executed if there is no exception raised within the try block.

Similar questions