+ 1
Why it's different in python? Please explain...
x=2 s=2 If x>1 & s>1: print (True) else: print (False) Output: False -------------------------- x=2 s=2 If (x>1) & (s>1): print (True) else: print (False) Output: True
11 Respuestas
+ 12
'&' is called bitwise And operator.
Check it out for reference. 
https://www.sololearn.com/learn/4072/?ref=app
x=2
s=2
If x>1 & s>1:
     print (True)
else:
     print (False)
Here, & operator has higher precedence than > operator
So,
x>1 & s>1 
=> 2> 1&2 >1 
=> 2>0>1 
=> True>1
=> false 
(x>1) & (s>1) here, operations are same but you have to consider the parenthesis since it has the highest precedence.
+ 4
Hushnudbek
for explanation read the answer of Jan Markus  sir !
x=2
s=2
print(x>1 & s > 1)
# False
because "&" have higher precedence than ">"
so first python will evaluate the expression --> 1 & s
means 1 & 2  # s=2
now see what "&" operator does
binary values of 1 and 2  are :
     0000 0001
     0000 0010
     ------------------
     0000 0000  = 0 in decimal 
so 1&2 = 0 
now our expression becomes 
--->> x > 0 > 1
which is, x=2  so.. 
--->> 2>0 >1
--->> True > 1 
--->> False 
-----------------------------------------------------
print( (x>1) & (s>1) )
#True
here, "()" paranthesis have higher precedence than "&"
so first python will evaluate the expression inside the paranthesis.. 
(x>1)  =  True
(s>1)  = True
so now our expression becomes
print( True & True)
#True 
how?  let's see :
The value of True is 1
so 1 & 1
0000 0001
0000 0001
-----------------
0000 0001  = 1 in decimal
and 1 means True
-->> (2 > 1) & (2> 1)
-->>  1 & 1
-->>  1
>>> True
Hope you are clear now!
+ 2
Simba  1 & 2 evaluate 0. not 1 as you shown in your example !
+ 1
What do you mean?
+ 1
Variables are declared X and S, then there is a comparison. If X is greater than 1 and S is greater than 1 at the same time, then output trueif otherwise, then false
0
Are there another differences in python syntax
0
Explain the syntax, please
0
???
0
Change "&" by "and" and solved
if x>1 and s>1:
if (x>1) and (s>1):
0
Python is high level language but it is little bit less compparitable than other language 
And in python and works like this 
X=2
S=2
If x>1 & s>1:
   It will check x>1--->2>1==>false
  And
  It will check x>2---->2>1==>true
And in python it happens like this 
True + false =>false 
||||||||||||||||||||||||||||||||||||||||
________₹____________
Thats why the output is false 
T think you understand this explanation
🤗🤗🤗🤗😃😃😃😃
0
Hey in python coding evaluating is different from other languages 
IN PYTHON :-
True + True ====>True
True + False====>False
False + False ===> False 
It happens like this : )









