【汇总】:https://blog.csdn.net/wistonty11/article/details/121348048
【2章:变量和简单数据类型】:https://blog.csdn.net/wistonty11/article/details/114553239
【3章:列表简介】:https://blog.csdn.net/wistonty11/article/details/114673314
【4章:列表操作】:https://blog.csdn.net/wistonty11/article/details/114684679
【5章:if语句】:https://blog.csdn.net/wistonty11/article/details/114932777
【6章:字典】https://blog.csdn.net/wistonty11/article/details/117432520
【7章:用户输入和while循环】:https://blog.csdn.net/wistonty11/article/details/117437656
【8章:函数】:https://blog.csdn.net/wistonty11/article/details/117448978
【9章:类】:https://blog.csdn.net/wistonty11/article/details/117521111
文章目录
# time:2021.06.01 儿童节快乐!!!!
# 收录在《口袋图书》系列:随时随地便于阅读
# 只节选了 重要/必要内容, 例子适当的简化
# 本文为摘抄总结 望赞鼓励
8.1 定义函数
def greet_user():
print("Hello!")
greet_user()
Hello!
-
定义:def 函数名(形参)
-
调用:函数名(实参)
def greet_user(username):
print("Hello, " + username.title() + "!")
greet_user('jesse')
Hello, Jesse!
8.2 参数传递
8.2.1 位置实参
def describe_pet(animal_type, pet_name):
print("\nI have a " + animal_type + ".")
print("My " + animal_type + "'s name is " + pet_name.title() +