Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

12-5 How will MIS help my career?

Answered: 1 week ago