def add(a,b):
print(a+b)
add(3,2)
结果:5
def add(a,b=6):
print(a+b)
add(a=3)
结果:9
return 返回值
def login(username="wuya",password='admin'):
if username=='wuya' and password=='admin':
return True
else:
return False
def profile():
if login():
return '登录成功'
else:
return '账号或者密码有错误'
print(profile())
结果:登录成功
原创文章,作者:jamestackk,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/269395.html