Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

6th Jan 2017, 5:52 AM
stephen haokip
stephen haokip - avatar
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
7th Jan 2017, 12:08 PM
NIKHIL MURARKA
+ 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!
1st Feb 2017, 10:51 PM
phil
phil - avatar
+ 1
X = 4 and y = 2 , the spaces count
6th Jan 2017, 4:37 PM
hackingmaster
hackingmaster  - avatar
0
... Can't you just run the code?
6th Jan 2017, 6:38 AM
Dao
Dao - avatar
0
no is the answer
26th May 2020, 8:19 AM
Ekshitha Balisetty
Ekshitha Balisetty - avatar
0
no answare
4th Aug 2021, 4:06 PM
Oluwanifemi Oyedemi
0
not((true)or(true and false)) =>not true= false
16th Oct 2021, 6:22 AM
Srikanta Rawlo
Srikanta Rawlo - avatar
0
What's the output of this code? print(7 != 8)
22nd Apr 2022, 6:29 PM
Tejas Gojariya
0
What's the output of this code? print(7 != 8)
22nd Apr 2022, 6:30 PM
Tejas Gojariya
- 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?)
6th Jan 2017, 7:26 AM
ifl
ifl - avatar