python——初识函数
一、初识函数定义与调用
#函数定义
def mylen():
"""计算s1的长度"""
s1 = "hello world"
length = 0
for i in s1:
length = length+1
print(length)
#函数调用
mylen()
#函数定义
def mylen():
"""计算s1的长度"""
s1 = "hello world"
length = 0
for i in s1:
length = length+1
print(length)
#函数调用
mylen()

![python——初识函数[Python常见问题]](https://www.zixueka.com/wp-content/uploads/2023/10/1696831883-e5ce6228f67b197.jpg)
