ScanSkill

% (modulus)

This % (modulus) arithmetic operator returns the decimal part (remainder) of the quotient of the two expressions.

Syntax

A % B

Here,

  • A: An expression that is evaluating to a numeric type.
  • B: An expression that is evaluating to a numeric type.

Examples

>>> 5 % 2
1
>>> 4.7 % 1
0.7000000000000002 # To know about this result more, refer to floating point numbers implementation
>>> (1+2j) % 1
2j