From f41d901c084220e471930e7531936c3a8e97d673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E9=93=B6=E5=86=9B?= Date: Mon, 20 Oct 2025 10:36:30 +0800 Subject: [PATCH] no message --- pythonProject/test/5_1.py | 7 +++++++ pythonProject/test/5_2.py | 2 ++ pythonProject/test/5_3.py | 2 ++ pythonProject/test/6.py | 13 +++++++++++++ pythonProject/基础/保留字.py | 2 +- pythonProject/第二章/if/双分支结构2.py | 5 ++--- 6 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 pythonProject/test/5_1.py create mode 100644 pythonProject/test/5_2.py create mode 100644 pythonProject/test/5_3.py create mode 100644 pythonProject/test/6.py diff --git a/pythonProject/test/5_1.py b/pythonProject/test/5_1.py new file mode 100644 index 0000000..10fa6d7 --- /dev/null +++ b/pythonProject/test/5_1.py @@ -0,0 +1,7 @@ +# 双分支 +num1=eval(input("请输入幸运数字:")) + +if num1==1: + print("幸运数字1") +else: + print("输入了其他幸运数字") \ No newline at end of file diff --git a/pythonProject/test/5_2.py b/pythonProject/test/5_2.py new file mode 100644 index 0000000..5a8b0f9 --- /dev/null +++ b/pythonProject/test/5_2.py @@ -0,0 +1,2 @@ +num = eval(input("请输入幸运数字:")) +print("输入了幸运数字1") if num==1 else print('输入了其他幸运数字') \ No newline at end of file diff --git a/pythonProject/test/5_3.py b/pythonProject/test/5_3.py new file mode 100644 index 0000000..fed8469 --- /dev/null +++ b/pythonProject/test/5_3.py @@ -0,0 +1,2 @@ +num = eval(input('输入了其他幸运数字:')) +print(f'您输入了幸运数字{num}') if num>=10 else print('输入了其他幸运数字!') \ No newline at end of file diff --git a/pythonProject/test/6.py b/pythonProject/test/6.py new file mode 100644 index 0000000..0789d36 --- /dev/null +++ b/pythonProject/test/6.py @@ -0,0 +1,13 @@ +# 匹配模式 +num=eval(input("请输入幸运数字:")) +match num: + case 1: + print("您输入了其他幸运数字1") + case 2: + print('您输入了其他幸运数字2') + case 3: + print('您输入了其他幸运数字3') + case 4: + print('您输入了其他幸运数字4') + case 12: + print('您输入了其他幸运数字12') \ No newline at end of file diff --git a/pythonProject/基础/保留字.py b/pythonProject/基础/保留字.py index 9b13eed..9365250 100644 --- a/pythonProject/基础/保留字.py +++ b/pythonProject/基础/保留字.py @@ -1,6 +1,6 @@ #保留字 #123 -import 保留字 +import keyword print(keyword.kwlist) print(len(keyword.kwlist)) print(keyword.kwlist) \ No newline at end of file diff --git a/pythonProject/第二章/if/双分支结构2.py b/pythonProject/第二章/if/双分支结构2.py index 4ac3fd5..44ff855 100644 --- a/pythonProject/第二章/if/双分支结构2.py +++ b/pythonProject/第二章/if/双分支结构2.py @@ -1,3 +1,2 @@ -number=eval(input("请输入幸运数字:")) -result="恭喜您中奖啦!" if number>60 else "hehe!" -print(result) \ No newline at end of file +num=eval(input("请输入幸运数字:")) +print('输入了幸运数字1') if num==1 else print('输入了其他幸运数字') \ No newline at end of file