1.形参与实参
def greet(name):
print("你好",name)
greet('Neil')
name是形参,Neil是实参,greet是一个函数,Neil的值传给函数,保存在形参中
2.位置实参
def pet(type,name)
print("this is type:",type ,"this is name:", name)
pet(type='harry',name='nick')
1.形参与实参
def greet(name):
print("你好",name)
greet('Neil')
name是形参,Neil是实参,greet是一个函数,Neil的值传给函数,保存在形参中
2.位置实参
def pet(type,name)
print("this is type:",type ,"this is name:", name)
pet(type='harry',name='nick')
本文标题:python实参与形参
本文链接:https://www.haomeiwen.com/subject/rkocmftx.html
网友评论