Python 基础-数值
来源:互联网 发布:unity3d导航网格寻路 编辑:程序博客网 时间:2024/06/06 01:05
>>> a = 3.0 + 4.0j
>>> float(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can't convert complex to float
>>> a.real
3.0
>>> a.imag
4.0
>>> abs(a) # sqrt(a.real**2 + a.imag**2)
5.0
>>> tax = 12.5 /100
>>> price = 100.50
>>> price * tax
12.5625
>>> price + _ # 交互模式下,最近一次表达式输出保存在_变量中。
113.0625 # 这意味着把Python当做桌面计算器使用时,它可以更容易的进行连续计算
>>> round(_,2)
113.06
>>>
阅读全文
0 0
- Python 基础-数值
- Python基础--数值类型
- python基础2之数值类型---字符串
- Python基础学习数值运算之内建函数
- python笔记-001-基础(字符串和数值)
- JavaScript基础之数值
- 数值计算基础
- Python学习(一) 数值
- python类型数值操作
- Python数值类型
- Python数值类型学习
- [Python Learning]数值计算
- 数值分析实验 Python
- Python 数值操作
- python 数值类型转换
- [python数值分析]最小二乘法
- 数值计算方法python实现
- JS基础之数值转换
- 一个归并排序(分治法)
- 更简单的主从复制
- binlog日志相关的一些语句
- Methods of taking a snapshot
- top 命令
- Python 基础-数值
- mysql-5.5.32-android.patch.v1
- Python 基础
- MAVEN指定JDK版本和字符集编码
- Python 基础
- Python
- 方法传参
- Python 基础-函数
- C++ Primer 11.1