0

What is Precedence

8th Dec 2022, 11:39 AM
Parveen
Parveen - avatar
1 Answer
+ 3
I think precedence in python talking about which operator is calcultated first. Which would take precedence or which one should go before the other. Example 10 + 5 * 7 Which would go first? The addition or the multiplication? According to BEDMAS (Brackets, Exponatiation, Division, Multiplication, Addition, Subtraction), the multiplication should take precedence or should be calculated before the addition. So you will work out the calculation as this, 5*7 // equals 35 10 + 35 // equals 45 Here is a helpful resource for other operators as well! https://www.educative.io/answers/what-is-operator-precedence-in-python
8th Dec 2022, 12:33 PM
Will