python-函数的定义与调用

蔚落 2023-06-16 08:21 44阅读 0赞

##1.1 函数的定义

在这里插入图片描述
==========实战1

  1. def Sun(name, age):
  2. return name,age
  3. res=Sun("张三", "47")
  4. print(res)

在这里插入图片描述

================实战2

  1. def say_hello():
  2. '''9*9乘法表'''
  3. row = 1
  4. # 1col=
  5. while row <= 9:
  6. col = 1
  7. while col <= row:
  8. print("%d*%d=%d" % (col, row, row * col), end=' ')
  9. col += 1
  10. print("")
  11. row += 1
  12. # say_hello()

在这里插入图片描述

2.2函数的调用

在这里插入图片描述
=========实战

  1. import 函数调用
  2. 函数调用.say_hello()

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,44人围观)

还没有评论,来说两句吧...

相关阅读