Notice
Recent Posts
Recent Comments
«   2024/10   »
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
Archives
Today
In Total
관리 메뉴

A Joyful AI Research Journey🌳😊

Understanding Floor Division and the divmod Function in Python 본문

🌳Coursework Insights🪄✨/Discrete Maths

Understanding Floor Division and the divmod Function in Python

yjyuwisely 2024. 2. 4. 07:00
a, b = 15, 4
print(a // b, a % b)
print(divmod(a, b))

result)

3 3
(3, 3)

The divmod(a, b) function is a built-in function in Python that takes two numbers as arguments and returns a tuple containing two values: the quotient (the result of the floor division a // b) and the remainder (a % b). Essentially, it combines the operations of floor division and modulo in a single function.

728x90
반응형
Comments