+ 2
HELLO CAN ANYONE EXPLAIN IN DETAIL WHAT IS ##OPERATOR PRECEDENCE## .......PLEASE $python$
3 Respostas
+ 5
Operator precedence is used when the given equation is not included in the parentheses and you have to solve it. Some operators have a higher precedence than the others. For Division operator has a higher precedence than the multiplication operator.
If you had to solve the following kind of equation, you will have to use operator precedence.
1**5*4+3/2+1
5*4+3/2+1 #1**5 = 1 as exponentiation goes first
5*4+1.5-1 # 3/2 = 1.5 as division then
20+1.5-1 #5*4 = 20 as multiplication then
21.5 - 1 # 20 + 0.5 = 20.5 as addition then
20.5 is answer # as subtraction at last.
Exponentiation > Division > Multiplication > Addition > Subtraction . This is the order of the operator precedence.
+ 2
You can find all operator precedence on the Internet in the python doc just here in 6.16 https://docs.python.org/3/reference/expressions.html
0
operator precedence is nothing but the hierarchy or the importance given to operator to perform its operation first