0

Any one help on this and pliz explain?? ..PYTHON3..

x=4 y=2 If not 1+1==y or x==4 and 7==8: print("yes") elif x>y: printf("no")

16th Apr 2020, 4:55 PM
Computerhead
Computerhead - avatar
2 ответов
+ 3
x=4 y=2 if (not 1+1==y) or (x==4 and 7==8): # "if" needs to be in lower case letters print("yes") elif x>y: # "elif" needs to have same indent as if print("no") # it is "print()" not "printf()" # There are 3 conditions if if expression, and they can be seen as: (not 1+1==y) or (x==4 and 7==8) according to the operator precedence. (not 1+1==y) => False and also (x==4 and 7==8) => False. So if expression gives False. elif expression x>y => True, so "no" will be printed.
16th Apr 2020, 5:16 PM
Lothar
Lothar - avatar
0
If statement will not execute, i guess. Because condition is false. So elif __> no is the answer.
16th Apr 2020, 5:01 PM
The Sylar