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!
Nesta página do site você pode assistir ao vídeo on-line Python Tutorial for Beginners 3 Basic Math, Mathematical Operators and Python Expressions duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Expert Programmer 01 January 1970, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 24 vezes e gostou 0 espectadores. Boa visualização!