Python Arithmetic Expressions, Math Operators, and Precedence Rules

preview_player
Показать описание
Expression: any combination of items such as variables, literals, operators and parenthesis. Ex: x = 5 * (y + 2). In an expression, the right-hand side is evaluated first to get the value, and then assigned to the left-hand side.

Literal: Actual values in your code. Commas are not allowed in integer literals, so 1,000 is written as 1000.

Arithmetic Operators: +, -, *, /, **
- ** is exponent (x ** y is x to the power of y)

Precendence Rules (in order of highest to lowest precedence). Operators with same precedence are evaluated from left-to-right.
()
- (unary)
* / %
+ -

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Рекомендации по теме