About 77,100 results
Open links in new tab
  1. What is the result of % (modulo operator / percent sign) in Python?

    This is because in JavaScript % is the "remainder" operator while in Python it is the "modulus" (clock math) operator. You can get the explanation directly from GvR: Edit - dahiya_boy In …

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

  3. The modulus operator (%) in python - Stack Overflow

    May 9, 2019 · I am new to programming, and I chose to learn Python, and I came across this operator (%) called modulus, but I don't understand it, can some explain it to me in more detail!

  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. Understanding The Modulus Operator - Stack Overflow

    Jul 8, 2013 · Modulus operator gives you the result in 'reduced residue system'. For example for there are 5 integers counted: 0,1,2,3,4. In fact . The main difference that the answer is given …

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

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

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

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

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

    Jan 5, 2022 · If the first statement is correct (True), it'll perform that action below regardless of what you write. If you're trying to use a different modulus such as % 7, you might get funky …