From d4645575d7deaf899bc0f906466d9405790cebaf Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Mon, 18 May 2026 09:19:17 +0800 Subject: [PATCH 1/6] no message --- pythonProject/流程语句/while/2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pythonProject/流程语句/while/2.py b/pythonProject/流程语句/while/2.py index d47d801..e78042e 100644 --- a/pythonProject/流程语句/while/2.py +++ b/pythonProject/流程语句/while/2.py @@ -1,5 +1,6 @@ a=0 while a<10: - if a<1: + a+=1 + if a<20: print('xxx') continue \ No newline at end of file From 7810590d2138af391fda71a84d2a6ed4164fe0c8 Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Mon, 18 May 2026 13:51:06 +0800 Subject: [PATCH 2/6] no message --- pythonProject/test/match.py | 10 ++++++++++ pythonProject/test/while.py | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 pythonProject/test/match.py create mode 100644 pythonProject/test/while.py diff --git a/pythonProject/test/match.py b/pythonProject/test/match.py new file mode 100644 index 0000000..49f9649 --- /dev/null +++ b/pythonProject/test/match.py @@ -0,0 +1,10 @@ +scope=input("请输入") +match scope: + case "1": + print("1") + case "2": + print("2") + case "3": + print("3") + case "4": + print("4") \ No newline at end of file diff --git a/pythonProject/test/while.py b/pythonProject/test/while.py new file mode 100644 index 0000000..fd4adf9 --- /dev/null +++ b/pythonProject/test/while.py @@ -0,0 +1,2 @@ +for i in range(-1,100): + print(i) \ No newline at end of file From 953283865641ef62ebb1bd451ee24c25c5ef2c9e Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Mon, 18 May 2026 15:26:32 +0800 Subject: [PATCH 3/6] no message --- pythonProject/内置函数/2.py | 9 --------- pythonProject/内置函数/def.py | 17 +++++++++++++++++ pythonProject/内置函数/{1.py => sum.py} | 0 3 files changed, 17 insertions(+), 9 deletions(-) delete mode 100644 pythonProject/内置函数/2.py create mode 100644 pythonProject/内置函数/def.py rename pythonProject/内置函数/{1.py => sum.py} (100%) diff --git a/pythonProject/内置函数/2.py b/pythonProject/内置函数/2.py deleted file mode 100644 index 94ce05e..0000000 --- a/pythonProject/内置函数/2.py +++ /dev/null @@ -1,9 +0,0 @@ -# 自定义函数 -def hehe(a,b,c): - print('hehe:'+a+b+c) - -hehe('x','y','z') - -def haha(a,b,c): - print('haha:'+a+b+c) -haha('x1','y1','z1') \ No newline at end of file diff --git a/pythonProject/内置函数/def.py b/pythonProject/内置函数/def.py new file mode 100644 index 0000000..ed9548c --- /dev/null +++ b/pythonProject/内置函数/def.py @@ -0,0 +1,17 @@ +# 自定义函数 +def hehe(a,b,c): + print('hehe:'+a+b+c) + +hehe('x','y','z') + +#函数返回值 +def haha(a,b,c): + """ + :param a:这是函数的文档1 + :param b:这是函数的文档2 + :param c:这是函数的文档3 + :return: 这是函数的文档4 + """ + return a+b+c +print("----") +print(haha(1,2,3)) \ No newline at end of file diff --git a/pythonProject/内置函数/1.py b/pythonProject/内置函数/sum.py similarity index 100% rename from pythonProject/内置函数/1.py rename to pythonProject/内置函数/sum.py From 3edc0b7b9f674761e51887503c5375a53314c7d6 Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Mon, 18 May 2026 16:13:55 +0800 Subject: [PATCH 4/6] 1111 --- pythonProject/内置函数/global.py | 10 ++++++++++ pythonProject/内置函数/nonlocal.py | 16 ++++++++++++++++ pythonProject/闭包/1.py | 10 ++++++++++ 3 files changed, 36 insertions(+) create mode 100644 pythonProject/内置函数/global.py create mode 100644 pythonProject/内置函数/nonlocal.py create mode 100644 pythonProject/闭包/1.py diff --git a/pythonProject/内置函数/global.py b/pythonProject/内置函数/global.py new file mode 100644 index 0000000..02b43f5 --- /dev/null +++ b/pythonProject/内置函数/global.py @@ -0,0 +1,10 @@ +def fun(): + global a + a = 101 + print(a) +# 函数正常调用 +fun() +print('-------------') + +#调用内部由global定义的变量 +print(a) diff --git a/pythonProject/内置函数/nonlocal.py b/pythonProject/内置函数/nonlocal.py new file mode 100644 index 0000000..88e0e35 --- /dev/null +++ b/pythonProject/内置函数/nonlocal.py @@ -0,0 +1,16 @@ + +"""" +nonlocal 是一个关键字 +用于在嵌套函数(即内部函数)中修改外层函数(非全局作用域)中的变量。 +""" +def fun1(): + b = 100 + def fun2(): + nonlocal b + b = 300 + print(b) + fun2() + print(b) +fun1() +print('----') +print(b) \ No newline at end of file diff --git a/pythonProject/闭包/1.py b/pythonProject/闭包/1.py new file mode 100644 index 0000000..7107f10 --- /dev/null +++ b/pythonProject/闭包/1.py @@ -0,0 +1,10 @@ +""" +闭包函数 +函数内部调用了函数外部的局部变量,并且外部函数返回内部函数即为闭包函数 +""" +def func1(): + a = 1001 + def func2(): + return a + return func2 +print(func1()()) \ No newline at end of file From 44a7888fd02fd700e149730a90d1aca907a979b7 Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Mon, 18 May 2026 17:29:42 +0800 Subject: [PATCH 5/6] no message --- pythonProject/内置函数/lambda/1.py | 4 ++++ pythonProject/内置函数/lambda/2.py | 4 ++++ pythonProject/内置函数/lambda/3.py | 3 +++ pythonProject/内置函数/lambda/4.py | 4 ++++ 4 files changed, 15 insertions(+) create mode 100644 pythonProject/内置函数/lambda/1.py create mode 100644 pythonProject/内置函数/lambda/2.py create mode 100644 pythonProject/内置函数/lambda/3.py create mode 100644 pythonProject/内置函数/lambda/4.py diff --git a/pythonProject/内置函数/lambda/1.py b/pythonProject/内置函数/lambda/1.py new file mode 100644 index 0000000..a366cff --- /dev/null +++ b/pythonProject/内置函数/lambda/1.py @@ -0,0 +1,4 @@ +# 简单加法 +add =lambda x,y:x+y +print(add(100,200)) +print("------") diff --git a/pythonProject/内置函数/lambda/2.py b/pythonProject/内置函数/lambda/2.py new file mode 100644 index 0000000..136562a --- /dev/null +++ b/pythonProject/内置函数/lambda/2.py @@ -0,0 +1,4 @@ +# 与map在一块使用 +numbers = [1,2,3,4] +a= list(map(lambda x:x*2,numbers)) +print(a) \ No newline at end of file diff --git a/pythonProject/内置函数/lambda/3.py b/pythonProject/内置函数/lambda/3.py new file mode 100644 index 0000000..08f879e --- /dev/null +++ b/pythonProject/内置函数/lambda/3.py @@ -0,0 +1,3 @@ +numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +a= list(filter(lambda x: x % 2 == 0, numbers)) +print(a) \ No newline at end of file diff --git a/pythonProject/内置函数/lambda/4.py b/pythonProject/内置函数/lambda/4.py new file mode 100644 index 0000000..065866f --- /dev/null +++ b/pythonProject/内置函数/lambda/4.py @@ -0,0 +1,4 @@ +students = [('Alice', 85), ('Bob', 90), ('Charlie', 78)] +sorted_students = sorted(students, key=lambda x: x[1]) +print(sorted_students) +# 按成绩排序: [('Charlie', 78), ('Alice', 85), ('Bob', 90)] \ No newline at end of file From 40a027ebd824e6fd529390d1e4cb6e9f037a973b Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Mon, 18 May 2026 17:58:02 +0800 Subject: [PATCH 6/6] no message --- pythonProject/{数据类型 => 格式化字符串}/f/1.py | 0 pythonProject/{数据类型 => 格式化字符串}/format/1.py | 0 pythonProject/{数据类型 => 格式化字符串}/format/2.py | 0 pythonProject/{数据类型 => 格式化字符串}/format/3.py | 0 pythonProject/{数据类型 => 格式化字符串}/format/4.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename pythonProject/{数据类型 => 格式化字符串}/f/1.py (100%) rename pythonProject/{数据类型 => 格式化字符串}/format/1.py (100%) rename pythonProject/{数据类型 => 格式化字符串}/format/2.py (100%) rename pythonProject/{数据类型 => 格式化字符串}/format/3.py (100%) rename pythonProject/{数据类型 => 格式化字符串}/format/4.py (100%) diff --git a/pythonProject/数据类型/f/1.py b/pythonProject/格式化字符串/f/1.py similarity index 100% rename from pythonProject/数据类型/f/1.py rename to pythonProject/格式化字符串/f/1.py diff --git a/pythonProject/数据类型/format/1.py b/pythonProject/格式化字符串/format/1.py similarity index 100% rename from pythonProject/数据类型/format/1.py rename to pythonProject/格式化字符串/format/1.py diff --git a/pythonProject/数据类型/format/2.py b/pythonProject/格式化字符串/format/2.py similarity index 100% rename from pythonProject/数据类型/format/2.py rename to pythonProject/格式化字符串/format/2.py diff --git a/pythonProject/数据类型/format/3.py b/pythonProject/格式化字符串/format/3.py similarity index 100% rename from pythonProject/数据类型/format/3.py rename to pythonProject/格式化字符串/format/3.py diff --git a/pythonProject/数据类型/format/4.py b/pythonProject/格式化字符串/format/4.py similarity index 100% rename from pythonProject/数据类型/format/4.py rename to pythonProject/格式化字符串/format/4.py