In this Video I am going to show How to Use Basic Math, Mathematical Operators and Python Expressions In python.
So what is an expression ? An expression is A data value or set of operations to compute a value.
Arithmetic operators we will use:
- * / addition, subtraction/negation, multiplication, division
% modulus, a.k.a. remainder
** exponentiation
precedence: Order in which operations are computed.
Mathematical Operators
Here are some commonly used mathematical operators
Syntax Math Operation Name
a+b {\displaystyle a+b\,} a+b\, addition
a-b {\displaystyle a-b\,} a-b\, subtraction
a*b {\displaystyle a\times b\,} a\times b\, multiplication
a/b {\displaystyle a\div b\,} a\div b\, division (see note below)
a//b {\displaystyle \lfloor a\div b\,\rfloor } \lfloor a\div b\,\rfloor floor division (e.g. 5//2=2) - Available in Python 2.2 and later
a%b {\displaystyle a~{\bmod {~}}b\,} a~{\bmod ~}b\, modulo
-a {\displaystyle -a\,} -a\, negation
abs(a) {\displaystyle |a|\,} |a|\, absolute value
a**b {\displaystyle a^{b}\,} a^{b}\, exponent
Order of Operations (Python Operator Precedence)
Highest precedence at top, lowest at bottom.Operators in the same box evaluate left to right..
Name Syntax PEMDAS Mnemonic
Parentheses ( ... ) Please
Exponents ** Excuse
Multiplication
and Division * , / , // , % My Dear
Addition
and Subtraction + , - Aunt Sally
DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
On this page of the site you can watch the video online Python Tutorial for Beginners 3 Basic Math, Mathematical Operators and Python Expressions with a duration of hours minute second in good quality, which was uploaded by the user Expert Programmer 01 January 1970, share the link with friends and acquaintances, this video has already been watched 24 times on youtube and it was liked by 0 viewers. Enjoy your viewing!