python3xiaobaike_2020/chapter2/2-5 python3小白课:数值类型之浮点型.md
2025-04-20 23:22:14 +08:00

34 lines
732 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# python3小白课数值类型之浮点型
我们继续来讲数值类型。
浮点型float是另一种数据类型。
我们日常见到的小数,含有小数点的,你就可以理解为属于浮点型。
加上小数点就会变成了浮点型。即使你写5000.0,它也是一个浮点型,请注意。
浮点型还能表示科学计数法比如5e3表示5×10<sup>3</sup>即5000。
我们来看点例子:
```python
# coding:utf-8
a = 3.14159
print(type(a))
b = 5000.0
print(type(b))
c = 5e3
print(c)
print(type(c))
```
大家自己在python shell里面动手试一下就好啦~
### 单词释义
| 单词 | 释义 |
| ----- | ---------------- |
| float | 浮动,表示浮点型 |