/ 与 //在Python3.0中的区别
来源:互联网 发布:淘宝公告栏素材 编辑:程序博客网 时间:2024/06/10 18:53
- 在Python 3.0中,’/’总是执行真除法,不管操作数的类型,都会返回包含任何余数的浮点结果;
- ’//’执行Floor除法,截除掉余数并且针对整数操作数返回一个整数,如果有任何一个操作数是浮点数,则返回一个浮点数。
幂运算操作符(**)比其左侧的一元操作符优先级高,比其右侧的一元操作符优先级低。eg:
5 ** -2 =0.04 -3 ** 2 = -9
优先级排列:not>and>or
eg: not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9
=(not 1) or (0 and 1) or( 3 and 4) or( 5 and 6 )or (7 and 8) and 9)
=0 or 0 or 4 or 6 or 9
=4 "短路逻辑"
阅读全文
0 0
- / 与 //在Python3.0中的区别
- Python2 与 Python3在串口编程中的区别
- urllib库在python2与python3中的区别
- python2与python3在pycharm中的切换
- python3中string类型中的index与find的区别
- python3.0与python2.x的区别
- python3.0与python2.X的区别
- python3 与 python2区别
- Python2与Python3的区别
- python2 与 python3 语法区别
- python2 与 python3 语法区别
- python2与python3的区别
- python2与python3的区别
- Python3与Python2的区别
- python2 与 python3 语法区别
- python2 与 python3 语法区别
- python2 与 python3 语法区别
- python2 与 python3 语法区别
- 安装OpenCV:OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置
- LeetCode-32.Longest Valid Parentheses最长有效括号子串
- VS2012的Web.config中使用machineKey
- 2016年大数据80篇爆款文章:这一年你追过的那些技术
- 【leetcode medium】2. Add Two Numbers
- / 与 //在Python3.0中的区别
- 【dp专题1】B
- 多线程——消费者与生产者案例
- 目录遍历的三种方法
- MQTT协议 格式
- Spring AOP 基础
- ACM零起点2017-7-25(随机数产生方法)
- java 语法 —— final
- Spring MVC + EasyUI实现地区级联