About 2,700,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 …

  3. 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 …

  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 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.

  6. 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, …

  7. math - Modular addition in python - Stack Overflow

    Aug 11, 2014 · You may need the result of the division besides the remainder modulo n, so here's a seconds-to-year+days+etc translator which demonstrates the divmod function. Of course, …

  8. 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?

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

    Aug 19, 2020 · 3 A documentação relevante está aqui, e diz que o operador % retorna o resto da divisão do primeiro número pelo segundo (" The % (modulo) operator yields the remainder …

  10. python - Modulo Operation for Odd & Even Number - Stack …

    Jan 5, 2022 · Modulo Operation for Odd & Even Number Asked 3 years, 10 months ago Modified 1 month ago Viewed 7k times