Skip to content

Files

Latest commit

906957e · May 24, 2017

History

History
21 lines (19 loc) · 874 Bytes

File metadata and controls

21 lines (19 loc) · 874 Bytes

Python divmod() Function

Compute quotient and remainder using the divmod() function.
The divmod() function takes two (non-complex) numbers as arguments and returns a pair of numbers consisting of their quotient and remainder when using integer division.
For integers, the result is the same as (a // b, a % b).

>>> divmod(1, 1)
(1, 0)
>>> divmod(3, 2)
(1, 1)
>>> divmod(3.0, 2)
(1.0, 1.0)

Instructions:
In this exercise, variables a and b are defined for you.
Define a variable named result that calls the divmod() function on variables a and b (in that order).