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!
In questa pagina del sito puoi guardare il video online Python Tutorial for Beginners 3 Basic Math, Mathematical Operators and Python Expressions della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Expert Programmer 01 January 1970, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 24 volte e gli è piaciuto 0 spettatori. Buona visione!