def total(initial = 5, *numbers, **keywords): count = initial for number in numbers: count += number for key in keywords: count += keywords[key] return count def printMax(x, y): '''Prints the maximum number, The two values must be have number.''' x = int(x) y = int(y) if x > y: print(x, ' is maximum number.') else: print(y, ' is maximum number.') print(total(10, 1, 2, 3, vegetables = 50, fruits = 100)) printMax(3, 5) print(printMax.__doc__)
相关文章
- 09-20Python函数的定义与调用、返回值、参数
- 09-20python函数中把列表(list)当参数时的"入坑"与"出坑
- 09-20python函数中的参数(关键字参数,默认参数,位置参数,不定长参数)
- 09-20Python中函数的参数传递与可变长参数
- 09-20Python入门之函数的形式参数与实参/参数的具体使用方法
- 09-20Python机器学习(Sebastian著 ) 学习笔记——第六章模型评估与参数调优实战(Windows Spyder Python 3.6)
- 09-20python 不定长参数
- 09-20Python *与** 参数问题
- 09-20Python-函数-参数类型(关键字、默认、不定长)
- 09-20python函数中把列表(list)当参数时的"入坑"与"出坑"