Fork me on GitHub
摘要: 函数的参数 形参和实参 所谓形参,就是函数定义中的参数,形参在函数体内可以使用,而实参,则出现在调用过程中 def print_diamond(count): for i in range(count): print(i) print_diamond(11) 上面的代码中,函数定义中的count就是 阅读全文
posted @ 2021-12-20 17:12 橘子偏爱橙子 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 函数是一种仅在调用时运行的代码块。您可以将数据(称为参数)传递到函数中,然后由函数可以把数据作为结果返回。 1. 函数的定义 def 函数名(参数列表): 函数体 在 Python 中,使用 def 关键字定义函数 def hello_word(): pass def print_diamond(c 阅读全文
posted @ 2021-12-20 15:50 橘子偏爱橙子 阅读(74) 评论(0) 推荐(0) 编辑