About 26,100 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?

    Jun 14, 2024 · PS. Note that I am using // instead of / -- this is Python 3 syntax, and also allowed in Python 2 to emphasize that you know you are invoking integer division. The / operator in …

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

    Jun 13, 2009 · I don't think you're fully grasping modulo. a % b and a mod b are just two different ways to express modulo. In this case, python uses %. No, 15 mod 4 is not 1, 15 % 4 == 15 …

  4. syntax - Python: % operator in print () statement - Stack Overflow

    Dec 8, 2013 · Intro The % operator in python for strings is used for something called string substitution. String and Unicode objects have one unique built-in operation: the % operator …

  5. What's wrong with this Modulo in Python 33 - Stack Overflow

    Dec 23, 2013 · The modulo operator is always available. In any case, an import does not change syntax, it only binds names. Also, note that the problem is completely unrelated to the modulo …

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

  7. Understanding The Modulus Operator - Stack Overflow

    Jul 8, 2013 · Modulus operator gives you the result in 'reduced residue system'. For example for mod 5 there are 5 integers counted: 0,1,2,3,4. In fact 19=12=5=-2=-9 (mod 7). The main …

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

  9. What does the percentage sign mean in Python [duplicate]

    Apr 25, 2017 · In python 2.6 the '%' operator performed a modulus. I don't think they changed it in 3.0.1 The modulo operator tells you the remainder of a division of two numbers.

  10. Python modulo on floats - Stack Overflow

    Feb 8, 2013 · This is pretty much fundamental to the definition of modulus, and it's wrong in Python, and just about every other programming language. But Python 3 comes to the rescue …

Refresh