python小白——进阶之路——day8天-———默认形参和实参的区别

####m默认形参 与关键字实参的区别
#函数的定义处 top middle bottom...默认形参
def five_class_xiongda_team(top="黄熊大",middle="黄文",bottom="罗婷",jungle="黄将用",support="王文"):
print("top上单选手{top}".format(top=top))
print("middle中单选手{middle}".format(middle=middle))
print("bottom下路单选手{bottom}".format(bottom=bottom))
print("jungle打野选手{jungle}".format(jungle=jungle))
print("support辅助选手{support}".format(support=support))
# 函数的调用处
# 关键字实参
# five_class_xiongda_team() top middle bottom ... 关键字实参
five_class_xiongda_team(top="张三",middle="李四",bottom="王五",jungle="马六",support="王文")

转载于:https://www.cnblogs.com/-sch-593057927/p/10854202.html

你可能感兴趣的:(python小白——进阶之路——day8天-———默认形参和实参的区别)