Q. Following expression does not report an error even if it has a sub-expression with ‘divide by zero’ problem:

3 or 10/0

What changes can you make to above expression so that Python reports this error?

 

Answer =

Because ‘or’ operator does not check more, if first value is true.

 

If we use ‘and’ operator then it will give an error.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post