5.4 函数的传入参数
一、函数传参
案例:
def add(x, y): count = x + y print(f"{x}+{y}={count}") add(2, 7)备注:
函数定义中,提供x和y,称之为形式参数(形参),表示函数将要使用两个参数,参数之间用逗号分割
函数调用中,提供的内容,称之为实际参数(实参),表示函数执行实际使用的参数,参数之间按照顺序,使用逗号分割
Last updated
Was this helpful?
案例:
def add(x, y):
count = x + y
print(f"{x}+{y}={count}")
add(2, 7)
备注:
函数定义中,提供x和y,称之为形式参数(形参),表示函数将要使用两个参数,参数之间用逗号分割
函数调用中,提供的内容,称之为实际参数(实参),表示函数执行实际使用的参数,参数之间按照顺序,使用逗号分割
Last updated
Was this helpful?
Was this helpful?