摘要:
python中函数可以返回任何类型的值,包含列表和字典等较复杂的数据结构。 1、 >>> def fun(first,last,age): full = {"first":first,"last":last,"age":age} ## 函数返回列表 return full >>> infor = f 阅读全文
摘要:
1、 >>> def a(first,middle,last): ## 函数定义了三个形参 full = f"{first} {middle} {last}" return full.title() >>> name = a("aaa","bbb","ccc") >>> print(name) Aa 阅读全文
摘要:
1、 >>> def a(x,y,z): print(x + y + z) >>> a(2,3,4) 9 >>> a(2,3) ## 缺少对应的实参 Traceback (most recent call last): File "<pyshell#317>", line 1, in <module 阅读全文