Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
python-demo
提交
f302e734
P
python-demo
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
python-demo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
python-demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f302e734
编写于
7月 27, 2024
作者:
秦
秦英杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:函数习题
上级
21b5fdec
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
72 addition
and
48 deletion
+72
-48
.idea/workspace.xml
.idea/workspace.xml
+46
-43
04_函数/02_函数基础定义练习案例.py
04_函数/02_函数基础定义练习案例.py
+5
-2
04_函数/03_list列表的循环.py
04_函数/03_list列表的循环.py
+1
-1
04_函数/04_函数的参数.py
04_函数/04_函数的参数.py
+2
-0
04_函数/07_None.py
04_函数/07_None.py
+7
-0
04_函数/08_函数的说明文档.py
04_函数/08_函数的说明文档.py
+2
-1
04_函数/09_函数的嵌套调用.py
04_函数/09_函数的嵌套调用.py
+5
-0
04_函数/10_变量的作用域.py
04_函数/10_变量的作用域.py
+4
-1
未找到文件。
.idea/workspace.xml
浏览文件 @
f302e734
...
...
@@ -4,24 +4,8 @@
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"a58667c7-f41c-4f13-881e-dc86f57d3cdc"
name=
"Changes"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/material_theme_project_new.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/material_theme_project_new.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/misc.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/misc.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/modules.xml"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/python-demo.iml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/python-demo.iml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/vcs.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/vcs.xml"
afterDir=
"false"
/>
<list
default=
"true"
id=
"a58667c7-f41c-4f13-881e-dc86f57d3cdc"
name=
"Changes"
comment=
"fix:基础语法"
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/01_Python入门语法/02_Python中的注释.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/01_Python入门语法/02_Python中的注释.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/01_Python入门语法/04_Python中的数据类型.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/01_Python入门语法/04_Python中的数据类型.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/01_Python入门语法/08_Python的字符串格式化.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/01_Python入门语法/08_Python的字符串格式化.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/02_Python判断语句/01_布尔类型和比较运算符.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/02_Python判断语句/01_布尔类型和比较运算符.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/02_Python判断语句/05_if_elif_else语句的使用.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/02_Python判断语句/05_if_elif_else语句的使用.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/03_Python循环语句/01_while循环练习题_求1-100的和.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/03_Python循环语句/01_while循环练习题_求1-100的和.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/03_Python循环语句/06_for循环练习题-数一数有几个a.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/03_Python循环语句/06_for循环练习题-数一数有几个a.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/03_Python循环语句/07_for循环的基础语法.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/03_Python循环语句/07_for循环的基础语法.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/03_Python循环语句/08_range语句.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/03_Python循环语句/08_range语句.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/03_Python循环语句/12_循环中断.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/03_Python循环语句/12_循环中断.py"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -31,37 +15,40 @@
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$"
/>
</component>
<component
name=
"ProjectColorInfo"
>
<![CDATA[
{
"associatedIndex"
: 7
}
]]>
</component>
<component
name=
"ProjectColorInfo"
>
{
"
associatedIndex
"
: 7
}
</component>
<component
name=
"ProjectId"
id=
"2jYDu6oib9nSDoOVTbxbUyGqmRv"
/>
<component
name=
"ProjectLevelVcsManager"
>
<OptionsSetting
value=
"false"
id=
"Update"
/>
</component>
<component
name=
"ProjectViewState"
>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
<component
name=
"PropertiesComponent"
>
<![CDATA[
{
"keyToString"
: {
"Python.01_while循环练习题_求1-100的和.executor": "Debug"
,
"Python.03_while循环的基础案例-猜数字.executor": "Debug"
,
"Python.05_while循环的嵌套案例-九九乘法表.executor": "Debug"
,
"Python.06_for循环练习题-数一数有几个a.executor": "Debug"
,
"Python.07_for循环的基础语法.executor": "Debug"
,
"Python.08_range语句.executor": "Debug"
,
"Python.09_变量作用域.executor": "Debug"
,
"Python.10_for循环打印九九乘法表.executor": "Debug"
,
"Python.12_循环中断.executor": "Debug"
,
"RunOnceActivity.ShowReadmeOnStart": "true"
,
"git-widget-placeholder": "main"
,
"last_opened_file_path": "/Users/qinyingjie/Documents/python-workspace/python-demo"
,
"node.js.detected.package.eslint": "true"
,
"node.js.detected.package.tslint": "true"
,
"node.js.selected.package.eslint": "(autodetect)"
,
"node.js.selected.package.tslint": "(autodetect)"
,
"nodejs_package_manager_path": "npm"
,
"settings.editor.selected.configurable": "configurable.group.appearance"
,
"vue.rearranger.settings.migration": "true"
<component
name=
"PropertiesComponent"
>
{
"
keyToString
"
: {
"
Python.01_while循环练习题_求1-100的和.executor
"
:
"
Debug
"
,
"
Python.03_while循环的基础案例-猜数字.executor
"
:
"
Debug
"
,
"
Python.05_while循环的嵌套案例-九九乘法表.executor
"
:
"
Debug
"
,
"
Python.06_for循环练习题-数一数有几个a.executor
"
:
"
Debug
"
,
"
Python.07_for循环的基础语法.executor
"
:
"
Debug
"
,
"
Python.08_range语句.executor
"
:
"
Debug
"
,
"
Python.09_变量作用域.executor
"
:
"
Debug
"
,
"
Python.10_for循环打印九九乘法表.executor
"
:
"
Debug
"
,
"
Python.12_循环中断.executor
"
:
"
Debug
"
,
"
RunOnceActivity.ShowReadmeOnStart
"
:
"
true
"
,
"
git-widget-placeholder
"
:
"
main
"
,
"
last_opened_file_path
"
:
"
/Users/qinyingjie/Documents/python-workspace/python-demo
"
,
"
node.js.detected.package.eslint
"
:
"
true
"
,
"
node.js.detected.package.tslint
"
:
"
true
"
,
"
node.js.selected.package.eslint
"
:
"
(autodetect)
"
,
"
node.js.selected.package.tslint
"
:
"
(autodetect)
"
,
"
nodejs_package_manager_path
"
:
"
npm
"
,
"
settings.editor.selected.configurable
"
:
"
configurable.group.appearance
"
,
"
vue.rearranger.settings.migration
"
:
"
true
"
}
}
]]>
</component>
}
</component>
<component
name=
"RunManager"
selected=
"Python.12_循环中断"
>
<configuration
name=
"07_for循环的基础语法"
type=
"PythonConfigurationType"
factoryName=
"Python"
temporary=
"true"
nameIsGenerated=
"true"
>
<module
name=
"python-demo"
/>
...
...
@@ -204,13 +191,29 @@
<option
name=
"number"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1721555336016
</updated>
<workItem
from=
"1721555337062"
duration=
"1175000"
/>
<workItem
from=
"1721555337062"
duration=
"3261000"
/>
<workItem
from=
"1721649016652"
duration=
"574000"
/>
<workItem
from=
"1721739596602"
duration=
"899000"
/>
<workItem
from=
"1721787987928"
duration=
"42000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"fix:基础语法"
>
<option
name=
"closed"
value=
"true"
/>
<created>
1721556543911
</created>
<option
name=
"number"
value=
"00001"
/>
<option
name=
"presentableId"
value=
"LOCAL-00001"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1721556543911
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"2"
/>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
<option
name=
"version"
value=
"3"
/>
</component>
<component
name=
"VcsManagerConfiguration"
>
<MESSAGE
value=
"fix:基础语法"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"fix:基础语法"
/>
</component>
<component
name=
"com.intellij.coverage.CoverageDataManagerImpl"
>
<SUITE
FILE_PATH=
"coverage/python_demo$06_for_a.coverage"
NAME=
"06_for循环练习题-数一数有几个a Coverage Results"
MODIFIED=
"1721556053815"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"false"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/03_Python循环语句"
/>
<SUITE
FILE_PATH=
"coverage/python_demo$09_.coverage"
NAME=
"09_变量作用域 Coverage Results"
MODIFIED=
"1721556377642"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"false"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/03_Python循环语句"
/>
...
...
04_函数/02_函数基础定义练习案例.py
浏览文件 @
f302e734
"""
演示函数基础定义练习案例:自动查核酸
"""
# 定义函数
def
check
():
# 编写函数体输出信息
print
(
"欢迎来到黑马程序员!
\n
请出示您的健康码以及72小时核酸证明!"
)
# 调用函数
check
()
\ No newline at end of file
check
()
04_函数/03_list列表的循环.py
浏览文件 @
f302e734
...
...
@@ -8,7 +8,7 @@ def list_while_func():
使用while循环遍历列表的演示函数
:return: None
"""
my_list
=
[
"传智教育"
,
"
黑马
程序员"
,
"Python"
]
my_list
=
[
"传智教育"
,
"程序员"
,
"Python"
]
# 循环控制变量通过下标索引来控制,默认0
# 每一次循环将下标索引变量+1
# 循环条件:下标索引变量 < 列表的元素数量
...
...
04_函数/04_函数的参数.py
浏览文件 @
f302e734
...
...
@@ -2,10 +2,12 @@
演示函数使用参数
"""
# 定义2数相加的函数,通过参数接收被计算的2个数字
def
add
(
x
,
y
,
z
):
result
=
x
+
y
+
z
print
(
f
"
{
x
}
+
{
y
}
+
{
z
}
的计算结果是:
{
result
}
"
)
# 调用函数,传入被计算的2个数字
add
(
5
,
6
,
7
)
04_函数/07_None.py
浏览文件 @
f302e734
...
...
@@ -2,22 +2,28 @@
演示特殊字面量:None
"""
# 无return语句的函数返回值
def
say_hi
():
print
(
"你好呀"
)
result
=
say_hi
()
print
(
f
"无返回值函数,返回的内容是:
{
result
}
"
)
print
(
f
"无返回值函数,返回的内容类型是:
{
type
(
result
)
}
"
)
# 主动返回None的函数
def
say_hi2
():
print
(
"你好呀"
)
return
None
result
=
say_hi2
()
print
(
f
"无返回值函数,返回的内容是:
{
result
}
"
)
print
(
f
"无返回值函数,返回的内容类型是:
{
type
(
result
)
}
"
)
# None用于if判断
def
check_age
(
age
):
if
age
>
18
:
...
...
@@ -25,6 +31,7 @@ def check_age(age):
else
:
return
None
result
=
check_age
(
16
)
if
not
result
:
# 进入if表示result是None值 也就是False
...
...
04_函数/08_函数的说明文档.py
浏览文件 @
f302e734
...
...
@@ -2,6 +2,7 @@
演示对函数进行文档说明
"""
# 定义函数,进行文档说明
def
add
(
x
,
y
):
"""
...
...
@@ -14,5 +15,5 @@ def add(x, y):
print
(
f
"2数相加的结果是:
{
result
}
"
)
return
result
add
(
5
,
6
)
add
(
5
,
6
)
04_函数/09_函数的嵌套调用.py
浏览文件 @
f302e734
...
...
@@ -2,9 +2,12 @@
演示嵌套调用函数
"""
# 定义函数func_b
def
func_b
():
print
(
"---2---"
)
# 定义函数func_a,并在内部调用func_b
def
func_a
():
print
(
"---1---"
)
...
...
@@ -13,5 +16,7 @@ def func_a():
func_b
()
print
(
"---3---"
)
# 调用函数func_a
func_a
()
04_函数/10_变量的作用域.py
浏览文件 @
f302e734
...
...
@@ -42,14 +42,17 @@
# global关键字,在函数内声明变量为全局变量
num
=
200
def
test_a
():
print
(
f
"test_a:
{
num
}
"
)
def
test_b
():
global
num
# 设置内部定义的变量为全局变量
global
num
# 设置内部定义的变量为全局变量
num
=
500
print
(
f
"test_b:
{
num
}
"
)
test_a
()
test_b
()
print
(
num
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录