随笔分类 -  python的函数

摘要:为什么要用函数:减少代码冗余,增加代码可读性 函数的定义与调用: #函数定义 def mylen(): """计算s1的长度""" s1 = "hello world" length = 0 for i in s1: length = length+1 print(length) #函数调用 myl 阅读全文
posted @ 2020-05-05 17:51 DCSun 阅读(122) 评论(0) 推荐(0)