More Arithmetic Operators


Modulus

To find the remainder, we use Modulus operator

%

  • a % b

Code

print(6 % 3)
PYTHON

Output

0

Exponent

To calculate a power b, we use Exponent Operator

**

  • a ** b

    Code

print(2 ** 3)
PYTHON

Output

8

You can use the exponent operator to calculate the square root of a number by keeping the exponent as

0.5

Code

print(16 ** 0.5)
PYTHON

Output

4.0

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post

Contact Form