Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 8-7: Album : Write a function called make_album () that builds a dictionary describing a music album. The function should take in an artist

Assignment 8-7:

Album: Write a function called make_album() that builds a dictionary describing a music album.

The function should take in an artist name and an album title, and it should return a dictionary containing these two pieces of information.

Use the function to make three dictionaries representing different albums.

Print each return value to show that the dictionaries are storing the album information correctly.

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

Assignment 8-8:

User Albums: Start with your program from Assignment 8-7.

Write a while loop that allows users to enter an albums artist and title.

Once you have that information, call make_album() with the users input and print the dictionary thats created.

Be sure to include a quit value in the while loop.

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

Exercise 8-9:

Magicians: Make a list of magicians names. Pass the list to a function called show_magicians(), which prints the name of each magician in the list.

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

Exercise 8-10:

Greet Magicians: Start with a copy of your program from Exercise 8-9.

Write a function called greet_magician() that modifies the list of magicians by adding a phrase to greet each magician.

Call show_magicians() to see that the list has actually been modified.

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

Exercise 8-11:

Unchanged Magicians: Start with your work from Exercise 8-10.

Call the function greet_magician() with a copy of the list of magicians names. Because the original list will be unchanged, return the new list and store it in a separate list.

Call show_magicians() with each list to show that you have one list of the original names and one list with a greeting phrase added to each magician.

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

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 for all 8 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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

Why are steels more difficult to cast than cast irons?

Answered: 1 week ago