Python arithmatic and logical Operation
Python arithmatic and logical Operation | Python tutorials Bestitworriors - Python Operation used to perform various function on python variables or values.There are many operation use on python variables or on values like Addition ( x + y or 2 + 4) Subtraction ( x - y or 4 - 3) and Multiplication ( x * y or 2 * 4) and Division ( x / y or 4 / 2) Modulus ( x % y or 2 % 4 ) and Exponentation ( x ** y or 2 ** 4) and Floor Division ( x // y or 4 // 2).Python perform assigning operation also like assign value to variable ( x = 2)
Some Key Points of Python Operations
- Python Operation use to perform functon on data or values
- Python operate Addition ( x + y or 2 + 4 )
- Python operate Subtraction ( x - y or 4 - 2 )
- Python operate Multiplication ( x * y or 2 * 4 )
- Python operate Division ( x / y or 2 / 4 )
- Python operate Modulus ( x % y or 2 % 4 )
- Python operate Exponentation ( x ** y or 2 ** 4 )
- Python operate Floor Division ( x // y or 2 // 4 )
- Python operate assignment ( x = 4 )
Code
var1 = 5
var2 = 4
addition = var1 + var2
print(addition)
substraction = var1 - var2
print(substraction)
multiplication = var1 * var2
print(multiplication)
division = var1 /var2
print(division)
modulus = var1 % var2
print(modulus)
exponentiation = var1 ** var2
print(exponentiation)
floordivision = var1 // var2
print(floordivision)
OutPut
9
1
20
1.25
1
625
1
1
20
1.25
1
625
1
0 Comments