About 51 results
Open links in new tab
  1. 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 …

  2. modulo - Python remainder operator - Stack Overflow

    Aug 29, 2013 · Most languages provide the one that matches the language's division operator.** Because Python uses floored division (following Knuth's argument in The Art of Computer …

  3. python - Getting Floor Division and Remainder at same time in 2 ...

    Nov 23, 2017 · Is there a python built-in (or just optimized) function to get the floor division and remainder at the same time in two separate variables? Example: a, b = 10 divided by 4 Desired …

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

    On Python 3 the calculation yields 6.75; this is because the / does a true division, not integer division like (by default) on Python 2. On Python 2 1 / 4 gives 0, as the result is rounded down.

  5. python - How to get Decimal division remainder in python3 ... - Stack ...

    Jun 27, 2017 · I looking for a pythonic way to get the remainder of a Decimal division. My use case here is I want to dispatch one price on several products. For example, I got an order of 10$ with 3 items, …

  6. python - Get quotients and remainder from division of floats - Stack ...

    May 7, 2023 · What is the Pythonic approach to getting a quotients and remainder from division of floats? So taking 8 divided by 3 which is 2.66666666666 so I want: aPythonOperator(8,3) = 2.0, …

  7. python - Python3 division: return int when there's no remainder and a ...

    Apr 15, 2016 · In python3, integer division works differently than in python 2.7.3. Is there a way to ensure that a number that doesn't have a remainder after division is returned as an int, while a …

  8. python - Dividing two numbers and printing the result and adding one …

    Feb 9, 2023 · I'm trying to divide number into groups in plain python without importing or the use of if-statements, and get the division into groups + remainder forming one extra group so that 200 / 99 …

  9. modulo - Python quotient vs remainder - Stack Overflow

    print 1.0*(1 % i) / i This computes the (integer) remainder as explained by others. Then you divide by the denominator again, to produce the fractional part of the quotient. Note that I multiply the result of the …

  10. Python modulus the same as remainder? - Stack Overflow

    Oct 10, 2013 · On the Python documentation it says "The % (modulo) operator yields the remainder from the division of the first argument by the second." So given a % b From what I know, the …