#coding:gbk
def make_pizz(*topping): #传递任意数量的实参为*号,但都是元祖
	
	print(topping)
make_pizz('banana')
make_pizz('banana','tomato','beer')



def build_profile(first,last,**user_info):
	'''创建一个任意数量的空字典user_info'''
	
	profile = {}
	profile['first'] = first
	profile['last'] = last
	for key,value in user_info.items():
		profile[key] = value
	return profile
user_profile = build_profile('ng','young',school = 'yejing school',city = 'jiangxi')
print(user_profile)

#习题 8-12-14
def sanmingzhi(*peiliao):
	print('你的三明治正在制作中,您的配料是:')
	for i in peiliao:
		print(i)
sanmingzhi('土豆泥','烤香蕉','炼乳','香肠')

def 简介(姓,名,**简介):
	p = {}
	p['姓'] = 姓
	p['名'] = 名
	for i,u in 简介.items():
		p[i] = u
	return p
j = 简介('伍','大爷',学校 = '冶金学院',技能 = '随意大小和粗细')
print(j)


def make_car(制造商,型号,**othering):
	car = {}
	car['制造商'] = 制造商
	car['型号'] = 型号
	for i,k in othering.items():
		car[i] = k
	return car
car = make_car('DAS Auto','甲壳虫',颜色 = '白色',生产日期 = '1987-01-10')
print(car)
最后修改:2022 年 12 月 05 日
如果觉得我的文章对你有用,请随意赞赏