Answers for "what is divmod in python"

4

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"
Posted by: Guest on December-31-2020

Python Answers by Framework

Browse Popular Code Answers by Language