-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8_divmod2.py
More file actions
36 lines (31 loc) · 1002 Bytes
/
8_divmod2.py
File metadata and controls
36 lines (31 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def modDivmod():
"""
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
For example:
>>> print divmod(177,10)
(17,7)
Here, the integer division is 177/10 => 17 and the modulo operator is
177%10 => 7.
Task:
Read in two integers,a and b, and print three lines.
The first line is the integer division a//b (While using Python2 remember
to import division from __future__).
The second line is the result of the modulo operator: a%b.
The third line prints the divmod of a and b.
Input Format
The first line contains the first integer, a, and the second line contains
the second integer, b.
Output Format
Print the result as described above.
Sample Input
177
10
Sample Output
17
7
(17,7)
"""
a,b = [int(input()) for _ in '12']
print(a//b, a%b, divmod(a,b), sep='\n')