+ 1

Code

What is the result of this code? if not True: print("1") elif not (1 + 1 == 3): print("2") else: print("3") please explain why 2

20th Feb 2018, 8:04 AM
Jordan
Jordan  - avatar
1 Answer
+ 11
"1" will not be printed because the condition of the first " if " statement is false: (not True) => False "2" is printed because the condition of the second " if "is true: (1+1 == 3) => ( 2 == 3 ) => False and not (1 + 1 == 3) => not False => True
20th Feb 2018, 8:19 AM
Mohammad Dakdouk
Mohammad Dakdouk - avatar