Python函数-divmod(),,divmod(a,b
文章由Byrx.net分享于2020-12-21 02:12:21
Python函数-divmod(),,divmod(a,b
divmod(a,b)函数
作用:
divmod(a,b)方法返回的是a//b(除法取整)以及a对b的余数,返回结果类型为tuple,参数:a,b可以为数字(包括复数)
1 >>> divmod(9,2)2 (4, 1)3 >>> divmod(11,3)4 (3, 2)5 >>> divmod(1+2j,1+0.5j)6 ((1+0j), 1.5j)
注:在python2.3版本之前不允许处理复数
Python函数-divmod()
相关内容
- python range()内建函数,,range()内建函
- python的坑--你知道吗?,,python的坑--
- python运算符与用法,,运算符与用法运算符名
- Python 操作符,,Python 操作符
- python 运算符,,1.算数运算符以下假
- 4. python-运算符(另类语法),,身份运算符 1 x
- Python,,鏍囩锛?a hre
- Python-any函数和all函数,,any函数: an
- python----基础函数,,---恢复内容开始-
- Python 函数Ⅱ,,以上代码中,[1,2
评论关闭