def menu(wine, entree, dessert='pudding'):
return {'wine': wine, 'entree': entree, 'dessert': dessert}
#位置参数
print(menu('bordeaux', 'beef', 'bagel'))
#关键字参数
print(menu(entree='beef', dessert='bagel', wine='bordeaux'))
print(menu('bordeaux', entree='beef', dessert='bagel'))
#指定默认参数值
print(menu('bordeaux', 'beef'))
def print_args(*args):
print('Positional argument tuple:', args)
def print_more(required1, required2, *args):
print('Need this one:', required1)
print('Need this one too:', required2)
print('All the rest:', args)
print_args()
print_args(3, 2, 1, 'wait!', 'uh...')
print_more('cap', 'gloves', 'scarf', 'monocle', 'mustache wax')

def print_kwargs(**kwargs):
print('Keyword arguments:', kwargs)
def print_all(*args, **kwargs):
print(len(args), args)
print(kwargs)
print_kwargs(wine='merlot', entree='mutton', dessert='macaroon')
print_all(1, 2, 3, a='a', b='b', c='c')
