487 - Soumyadip Maji - Use of Arithmetric Operators in Python
487 - Soumyadip Maji - Use of Arithmetric Operators in Python
**
Addition Subtractio Multiplicatio Division Modulus Exponentiatio Floor
n n n Division
Addition
Description: Adds two values.
Example:
x = 10
y=5
print(x + y) # Output: 15
Subtraction (-)
•Description: Subtracts the second value from the first..
•Example:
x = 10
y=5
print(x - y) # Output: 5
Multiplication (*)
•Description: Multiplies two values.
•Example:
x = 10
y = 5 print(x * y)
# Output: 50
Division (/)
•Description: Divides the first value by the second.
•Example:
x = 10
y = 5 print(x / y)
# Output: 2.0
Exponentiation (**)
•Description: Raises the first value to the power of the second.
•Example:
x=2
y = 3 print(x ** y)
# Output: 8
Modulus (%)
•Description: Returns the remainder of the division.
•Example:
x = 10
y = 3 print(x % y)
# Output: 1
Floor Division (//)
•Description: Divides and rounds down to the nearest integer.
•Example:
x = 10
y = 3 print(x // y)
# Output: 3
Combining Operators
•Examples of combining operators in expressions:
result = (10 + 5) * 2 - 4
print(result)
# Output: 26
Practical Applications