def是关键字(不可改变)
mylen是函数名(可以改变)
函数名#
函数名必须由字母下划线数字组成,不能是关键字,不能由数字开头
函数名虽然可以随便写 但是也要简单说明函数功能
():必须写
():以下的叫函数体(可以改变)
# def mylen(): # ''' # 计算字符串长度 #函数这里要加三引号注释,表明名这个函数的作用# # ''' # s='hello world' # length=0 # for i in s: # length+=1 # print(length) ###写完函数体 尽量不要改print值 # return length ###返回函数值 ##函数的调用:函数名字+括号 # leng=mylen() # print(leng)