divmod() in python code example
Example 1: python divmod
a = 6
b = 4
# a // b = 1
# a % b = 2
print(divmod(a,b))
>> (1, 2) # tuple
print(*divmod(a,b))
>> "1 2"
Example 2: divmod
div, remainder = divmod(numerator, denominator)
a = 6
b = 4
# a // b = 1
# a % b = 2
print(divmod(a,b))
>> (1, 2) # tuple
print(*divmod(a,b))
>> "1 2"
div, remainder = divmod(numerator, denominator)