Python 学习笔记一
来源:互联网 发布:软件接口通信 编辑:程序博客网 时间:2024/05/02 04:48
1、
'/'
performs float division and '//'
performs integer division
<span style="color:#39424e;">>>> </span><span style="color:#ff0000;">from __future__ import division</span><span style="color:#39424e;">>>> print 4/31.3333333333333333 >>> print 4//31</span>
2、
One of the built-in functions of Python is divmod, which takes two arguments
Here
>>> print divmod(177,10)(17, 7)
Here 177//10 => 17
and 177%10 => 7
3、
We have only heard of the powers of Python, so far; now we will witness them :)
Power or exponent in Python can be calculated using the built-in power function. Which can be called as for
>>> pow(a,b)
or
>>> a**b
It's also possible to calculate
>>> pow(a,b,m)
This is very helpful in computations where you have to print result % mod.
Note that here
Note Python has a module math, which has its own pow() but it takes two arguments and returns a float. Frankly speaking, we willnever use math.pow()
- Python学习笔记(一)
- Python学习笔记[一]
- Python学习笔记一
- python学习笔记(一)
- Python学习笔记(一)
- Python学习笔记一
- python学习笔记一
- python 学习笔记一
- python 学习笔记一
- python学习笔记: 一
- python学习笔记(一)
- Python学习笔记(一)
- python学习笔记一
- python学习笔记一
- Python学习笔记一
- Python学习笔记一
- Python学习笔记一
- python学习笔记一
- eclipse 无法启动,eclipse 快捷键
- Swift 解决进入程序后通知栏内的消息提醒不消失的问题
- IO流(三):字符流及其缓冲流
- SIGCHLD
- std::cout、std::cin与cout.cin
- Python 学习笔记一
- Supervised Descent Method Face Alignment 代码下载 和 算法研究 之一
- VS2010中CString Format出错
- 苹果开发者账号,有个人账号、团队账号、企业账号、教育账号,分别是做什么用?
- 黑马程序员_C语言中 break与continue的区别
- fnt 图字原理
- Linux下,java获取CPU使用率、内存使用率
- Web项目身份验证设置为Windows时如何将项目部署到IIS进行调试
- iOS:Xcode info.plist说明