- 8-12
def make_sandwhich(*ingredients):
print("\nMaking sandwhich with the following ingredients:")
for ingredient in ingredients:
print("- " + ingredient.title())
make_sandwhich('ham')
make_sandwhich('ham','egg')
make_sandwhich('ham', 'egg','cheese')
- 8-13
def build_profile(first,last,**user_info):
profile = {}
profile['first name'] = first
profile['last name'] = last
for key, value in user_info.items():
profile[key] = value
return profile
print(build_profile('Jiarun','Shen',location='Chongqing',field='EE'))
- 8-14
def buy_car(brand,type,**car_info):
profile = {}
profile['brand'] = brand
profile['type'] = type
for key, value in car_info.items():
profile[key] = value
return profile
print(buy_car('subaru','forester',color='blue',tow_package=True))