动手试试,函数

12.编写一个函数,接受顾客要在三明治中添加一系列食材,只有一个形参,打印一条消息,对顾客点的三明治进行概述,调用函数三次 每次都提供不同数量的实参。

def food(*args):
    print('顾客需求',args)
food('meal')
food('beaf','tomato','peach')
food('cabage','apple','pear','meal')

13.创建函数,接收键值对

def info(name,age,**kwargs):
    all={}
    all['name']=name
    all['age']=str(age)
    for key,value in kwargs.items():
        all[key]=value
    return all
c=info('jack',16,like='girl',sex='male',married='N')
print(c)

 14.函数的导入,没弄明白

原文地址:https://www.cnblogs.com/xusuns/p/8215265.html