函数

  • 初识
def say_hello ():
    print('hello~')


say_hello()
  • 带参数
def say_hello (msg):
    print(msg)


say_hello('hello~')
  • 默认参数
def say_hello (msg='hello~'):
    print(msg)


say_hello()
say_hello('python')
贡献者: mankueng