python中divmod是什么意思-Python教程

资源魔 32 0

python中divmod是甚么意义?

python中divmod()是一个内置函数。python divmod()函数把除了数以及余数运算后果连系起来,前往一个蕴含商以及余数的元组(a // b, a % b)。

正在 python 2.3 版本以前没有容许解决单数。

函数语法

divmod(a, b)

参数阐明:

a: 数字

b: 数字

实例

>>>divmod(7, 2)
(3, 1)
>>> divmod(8, 2)
(4, 0)
>>> divmod(1+2j,1+0.5j)
((1+0j), 1.5j)

相干保举:《Python教程》

以上就是python中divmod是甚么意义的具体内容,更多请存眷资源魔其它相干文章!

标签: Python python教程 python编程 python使用问题

抱歉,评论功能暂时关闭!