网页学习体会

  • 首页
  • 个人博客
您的位置: 首页  >  IT文章  >  Python divmod() 函数 Python divmod() 函数

Python divmod() 函数 Python divmod() 函数

分类: IT文章 • 2022-06-06 15:19:34

Python divmod() 函数
Python divmod() 函数 Python 内置函数

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 divmod() 函数
Python divmod() 函数 Python 内置函数

相关推荐

  • python函数名和左括号之间不能有空格
  • python内置函数  
  • python函数式编程
  • python学习笔记十二-函数
  • Python中map和reduce函数
  • python 函数式编程 高阶函数 装饰器
  • python常见的函数和类方法
  • python函数基础 一,函数的基础定义 二,函数的参数 三,动态参数
  • 面向对象进阶 1,item系列 2,Python上下文管理器以及with语句 3,通过__iter__,__next__实现迭代器协议 4,构析函数 6,__slots__方法 7,元类
  • 定制自己的数据类型 1,python中内建函数isinstance的用法 2,内置函数issubclass的用法 3,反射 4,内置atter __getattr__  
  • Python id() 函数 Python id() 函数
  • Python next() 函数 Python next() 函数
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 网页学习体会    备案号:   粤ICP备20002247号