About 4,440,000 results
Open links in new tab
  1. Modulo operator in Python - Stack Overflow

    What does modulo in the following piece of code do? from math import * 3.14 % 2 * pi How do we calculate modulo on a floating point number?

  2. What is the result of % (modulo operator / percent sign) in Python?

    The modulo operator always yields a result with the same sign as its second operand (or zero); the absolute value of the result is strictly smaller than the absolute value of the second operand [2].

  3. How to calculate a mod b in Python? - Stack Overflow

    Jun 13, 2009 · Is there a modulo function in the Python math library? Isn't 15 % 4, 3? But 15 mod 4 is 1, right?

  4. How does the modulo (%) operator work on negative numbers in …

    Oct 7, 2010 · Exactly how does the % operator work in Python, particularly when negative numbers are involved? For example, why does -5 % 4 evaluate to 3, rather than, say, -1?

  5. python - Find the division remainder of a number - Stack Overflow

    That's because Python's % performs a true modulus, which returns values on the range [0, divisor) and pairs well with floored division (towards negative infinity). C languages use the % operator for …

  6. python - Como funciona o operador módulo (%)? - Stack Overflow em …

    Aug 19, 2020 · A documentação ainda menciona que " The modulo operator always yields a result with the same sign as its second operand (or zero) " (o operador % sempre retorna um valor cujo sinal é …

  7. python - If statement with modulo operator - Stack Overflow

    Nov 8, 2016 · Open up the Python console, and do 4 % 2, what is the result? Then do 3 % 2, what is the result? Now which of the results would be considered "true"? The modulo operator returns the …

  8. C and Python - different behaviour of the modulo (%) operation

    Python has a "true" modulo operation, while C has a remainder operation. It has a direct relation with how the negative integer division is handled, i.e. rounded towards 0 or minus infinite. Python rounds …

  9. Python modulo on floats - Stack Overflow

    Feb 8, 2013 · Can anyone explain how the modulo operator works in Python? I cannot understand why 3.5 % 0.1 = 0.1.

  10. Modulo and order of operation in Python - Stack Overflow

    Jan 19, 2011 · What the % in python actually is is a modulus operator where x % y gives the remainder of x / y. In this case, what happened was that 75 / 4 is 18, with a remainder of 3, which is why 100 - 3 …