+ 1
If else logic is not clear in the given scenario
if 1 + 1 == 2: if 2 * 2 == 8: print("if") else: print("else") Ans: Else
2 Antworten
+ 1
It is too simple, always nearest condition of parentheses will be executed first, here 1+1 ==2 (true),
But 2*2 is not equal to 8, so the else's block will be execute.
+ 2
First 1+1=2==2 true
Second 2*2=4==8 false
So output will be Else