0

Anyone please answer how this coding works ??? Because in the first two lines two if statement lies and the output is else

if 1+1==2: if 2*2==8: print('if') else: print('else')

19th May 2020, 7:36 AM
shellow s
shellow s - avatar
1 Answer
+ 1
Look, the first if condition is true.. So, it enters into the if.. And again checks the condition which is false... According to your code it doesn't print anything... In case, if you write the code like below, you'll get o/p as else(else block gets executed) if 1+1==2: if 2*2==8: print('if') else: print('else')
19th May 2020, 8:01 AM
sarada lakshmi
sarada lakshmi - avatar