Arithmetic operators in Python

// – floor division operator. It ignores the decimal and gives the floor of the number. For negative values, it goes more negative side and returns the value.
** – exponentiation operator
code example :
"""
@author: rdayala
Check link - https://www.python-course.eu/python3_operators.php
"""
"""
+ Addition – Sum of two operands a+b
– Subtraction – Difference between the two operands a-b
* Multiplication – Product of the two operands a*b
/ Float Division – Quotient of the two operands a/b
// Floor Division – Quotient of the two operands (Without fractional part) a//b
% Modulus – Integer remainder after division of ‘a’ by ‘b.’ a%b
** Exponent – Product of ‘a’ by itself ‘b’ times (a to the power of b) a**b
"""
a = 7
b = 4
print('Sum : ', a + b) # output : 11
print('Subtraction : ', a - b) # output : 3
print('Multiplication : ', a * b) # output : 28
print('Division (float) : ', a / b) # output : 1.25
print('Division (floor) : ', a // b) # output : 1 - integer division
print('Modulus : ', a % b) # output : 3 - remainder
print('Exponent : ', a ** b) # output : 2401
Increment / Decrement operators
If you are familiar with other programming languages like C, Java then you know there exists two operators namely Increment and Decrement operators denoted by ++ and -- respectively.
There is no Increment and Decrement operators in Python.
This may look odd but in Python if we want to increment value of a variable by 1 we write += or x = x + 1 and to decrement the value by 1 we use -= or do x = x - 1.
Check link – https://www.dyclassroom.com/python/python-increment-and-decrement-operators