Q. Consider the following two fragments:


if x == 5 :
    x = x + 1
else:
    x = 8

if x ==5:
    x = x + 1
if x != 5:
    x = 8

Are the two fragments logically equivalent? Why or why not?


Answer :-

Yes. the two given code is logically equivalent. Because their output is same.

Post a Comment

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

Previous Post Next Post