Scroll Down to See All▾
absaiterallanextanyasciibinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdelattrdictenumerateevalexecfilterfloatformatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszip__import__clear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: divmod
Description
Returns a tuple of the quotient and remainder when dividing a by b.
Extended Description
The divmod() function takes two numbers as arguments and returns a tuple containing the quotient and the remainder when dividing the first argument by the second. For integers, the result is the same as (a // b, a % b). For floating point numbers, the result is (q, a % b), where q is usually math.floor(a / b) but may be 1 less than that.
Exceptions
- ZeroDivisionError: If the second argument (b) is zero
- TypeError: If the arguments are not numbers or are of incompatible types
Read More about divmod from Python Documentation
Function Signature
divmod(a: Number, b: Number) -> Tuple[Number, Number]
Module: builtins
Parameters
a: The dividend (number to be divided). b: The divisor (number to divide by).
Parameter List
- a: Number
- b: Number
Return
Returns a tuple (quotient, remainder) of numbers of the same type as the input arguments.
Return Type
Tuple[Number, Number]
Output
Explanation
This example shows how divmod() works with positive and negative integers.