What is the order of precedence in python?

Questions & AnswersCategory: Programming LanguageWhat is the order of precedence in python?
Geek Boy Staff asked 2 years ago

What is the order of precedence in python?
a. Exponential
Parentheses
Multiplication
Division
Addition
Subtraction
b. Exponential
Parentheses
Division
Multiplication
Addition
Subtraction
c. Parentheses
Exponential
Multiplication
Division
Subtraction
Addition
d. Parentheses
Exponential
Multiplication
Division
Addition
Subtraction

1 Answers
Geek Boy Staff answered 2 years ago

d. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
Explanation: For order of precedence, just remember this PEMDAS (similar to BODMAS).