0

How does the answer 2 explain the following boolean logic code?

If not True: Print("1") Elif not (1+1==3): Print("2") Else: Print("3")

15th Aug 2016, 1:16 PM
harkirat singh
harkirat singh - avatar
2 odpowiedzi
+ 15
the first logic check will always return False because "not True" equals False (the opposite of True), then we go to the second check which brakes down: 1+1 is 2,so 2=3 is False, now "not (2=3)" - we just reverse the answer which was False so now it's True, once an If statement is true, we execute it's indented statements and leave the whole lf block - so we get 2 as the answer to the block If you like my answer please +1 it by hiting the "thumbs up" symbol
15th Aug 2016, 2:06 PM
jocker-il
jocker-il - avatar
0
Thanks
15th Aug 2016, 2:20 PM
harkirat singh
harkirat singh - avatar