0
Help
x=4 y=2 if not 1+1==y or x==4 and 7==8: print ("yes") elif x>y: print ("No") here in order to print yes three conditions are given.... i expect two conditions... because the boolean logic compares only two conditions...and what is the output.. plis help me in detail
10 Answers
+ 4
well I think 1+1=y is true ,x=4 is true 7==8 is false the precedence order follows like this:
not((true)or(true and false))
=not true= false
+ 4
Remember not means "not true", and a False output continues the code.
So for example not 1==1 would give a False output.
x=4
y=2
if not 1+1==y or x==4 and 7==8: <== (false, false, and false...continue code)
print ("yes")
elif x>y: <==(4>2, true, so 'No' prints)
print ("No")
line 3 reads if not 1+1==y or x==4 and 7==8:
so if 1+1==y is not true (2==2) is false, or x is not true (4==4) is also false.
And if 7==8 is not true (which is false) print 'yes' but all 3 are false.
I hope this helps!
+ 1
X = 4 and y = 2 , the spaces count
0
... Can't you just run the code?
0
no is the answer
0
no answare
0
not((true)or(true and false))
=>not true= false
0
What's the output of this code?
print(7 != 8)
0
What's the output of this code?
print(7 != 8)
- 1
copy and run this code in the playground gives the answer straight away. so what is it you dont understand exactly? (are you confused about the code?)