Precedence Rule
Precedence Rule
# Left-right associativity
# Output: 3
print(5 * 2 // 3)
Output
3
0
z) .
# Initialize x, y, z
x = y = z = 1
# Expression is invalid
# (Non-associative operators)
# SyntaxError: invalid syntax
x = y = z+= 2
a = 20
b = 10
c = 15
d = 5
e = 0
e = (a + b) * c / d #( 30 * 15 ) / 5
print "Value of (a + b) * c / d is ", e
Ques
>>> 2+3*4//2-4
Step 1 : - 2+12//2-4
Step 2 : - 2+6-4
Answer >>4
Ques
>>> 10%3 -10//3
-2
Step 1 :- 1- 10//3
Step 2 :- 1- 3
Step 3 >>> 1-3
Answer -2
>>> 51+4-3**3//19-3
51
>>> 81//19
4
>>> 3**3
27
>>> 27//19
1
>>> 2+3*4//2-4
4
>>> 2+6-4
4
>>> 10%3 -10//3
-2
>>> 10%3
1
>>> 10//3
3
>>> 1-3
-2