PYTHON不定参数与__DOC__

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__)

PYTHON不定参数与__DOC__

上一篇:【cs229-Lecture16】马尔可夫决策过程


下一篇:Oracle的基本学习(一)—安装Oracle