Question: Assignment 8-12: Sandwiches : Write a function that accepts a list of items a person wants on a sandwich. The function should have one parameter

Assignment 8-12:

Sandwiches: Write a function that accepts a list of items a person wants on a sandwich.

The function should have one parameter that collects as many items as the function call provides, and it should print a summary of the sandwich that is being ordered.

Call the function three times, using a different number of arguments each time.

------------------------------------------------------------

Assignment 8-13:

User Profile: Start with a copy of the following code:

def build_profile(first, last, **user_info):

"""Build a dictionary containing everything we know about a user."""

profile = {}

profile['first_name'] = first

profile['last_name'] = last

for key, value in user_info.items():

profile[key] = value

return profile

user_profile = build_profile('albert', 'einstein',

location='princeton',

field='physics')

print(user_profile)

Build a profile of yourself by calling build_profile(), using your first and last names and three other key-value pairs that describe you.

------------------------------------------------------------

Assignment 8-14:

Cars: Write a function that stores information about a car in a dictionary.

The function should always receive a manufacturer and a model name. It should then accept an arbitrary number of keyword arguments.

Call the function with the required information and two other name-value pairs, such as a color or an optional feature.

Your function should work for a call like this one:

car = make_car('subaru', 'outback', color='blue', tow_package=True)

Print the dictionary thats returned to make sure all the information was stored correctly.

i need the correct python code for all of them fast please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!