Problem Name: Python -
In this HackerRank Functions in PYTHON problem solution,
One of the built-in functions of Python is divmod, which takes two arguments a and b and returns a tuple containing the quotient of a / b first and then the remainder a.
>>> print divmod(177,10) (17, 7)
Here, the integer division is
177/10 => 17 and the modulo operator is
177%10 => 7.
Read in two integers, a abd b and print three lines.
The first line is the integer division a / b (While using Python2 remember to import
The second line is the result of the modulo operator: a%b
The third line prints the divmod of a and b.
The first line contains the first integer a. and the second line contains the second integer ,b.
Print the result as described above.
17 7 (17, 7)
#1 Code Example with Python Programming
Copy The Code & Try With Live Editor
a = int(input()) b = int(input()) q, r = divmod(a, b) print(q, r, (q, r), sep='\n')