Python学习第十三篇——函数的深层次运用
1 def make_pizza(size,*toppings): 2 print("\nmaking a "+str(size)+" size pizza with following toppings:") 3 for topping in toppings: 4 print("-"+topping) 5 6 make_pizza(12,'apple') 7 make_pizza(25,"banana","mango","beaf","tomato") 8 #-------------- 9 def build_profile(first_name,last_name,**user_info): 10 profile = {} 11 profile['first'] = first_name 12 profile['last'] = last_name 13 for key,value in user_info.items(): 14 profile[key] = value 15 return profile 16 17 message = build_profile('albert','einstein',nation='American',filed='physics') 18 print(message)
stay foolish,stay hungry