Files
book/basic/tips/cheatsheet/index.md
2024-10-29 11:27:58 +08:00

27 lines
374 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.

# Python 小抄
> 抄抄抄
1. 输出保留两位小数
```py
a = 10.2980
print("%.2f" % a)
```
2. 输入一个整数
```py
a=int(input())
```
3. 输入两个整数,用空格隔开
```py
n=input().split()
a=int(n[0])
b=int(n[1])
```
4. 输入文字用空格隔开这里用三个文字做例子比如iPhone Huawei Xiaomi
```py
a,b,c=input().split()
```