'''
函数在定义时,可以在参数列表的位置定义形参
如果函数有形参,那么在调用时必须传递参数(实参)
实参将传递给形参的过程,本质上就是变量的赋值操作
'''# 带有参数的函数,如何定义# 在定义函数时,在小括号内可以定义形参(形式上的参数)defhello(suyi):print(f'There is a crack in everything,that is how the light gets in.{suyi}')# 调用带有形参的函数时,需要传递参数(实参)# hello('苏怡')# hello() #TypeError: hello() missing 1 required positional argument: 'suyi'# 带有多个参数的函数deflove(x,y):print(f'{x} love {y}')
love('苏怡','小金')# 函数定义了几个参数,那么在调用时必须指定顺序进行参数的传递