From 13e9d7f148e2a5acfdf4082e38a5f6a3ac5af0f6 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 29 Oct 2024 11:27:58 +0800 Subject: [PATCH] update --- basic/tips/cheatsheet/index.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/basic/tips/cheatsheet/index.md b/basic/tips/cheatsheet/index.md index 084c515..7d70cbf 100644 --- a/basic/tips/cheatsheet/index.md +++ b/basic/tips/cheatsheet/index.md @@ -1 +1,26 @@ -# Python 小抄 \ No newline at end of file +# 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() +```