Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following scenario about using Python dictionaries: Tessa and Rick are hosting a party. Together, they sent out invitations, and collected the responses in

Consider the following scenario about using Python dictionaries: Tessa and Rick are hosting a party. Together, they sent out invitations, and collected the responses in a dictionary, with names of their friends and the number of guests each friend will be bringing. Complete the function so that the check_guests function retrieves the number of guests (value) the specified friend guest (key) is bringing. This function should: accept a dictionary guest_list and a key guest variable passed through the function parameters; print the values associated with the key variable.

def check_guests(guest_list, guest):

return ___ # Return the value for the given key

guest_list = { "Adam":3, "Camila":3, "David":5, "Jamal":3, "Charley":2, "Titus":1, "Raj":6, "Noemi":1, "Sakira":3, "Chidi":5}

print(check_guests(guest_list, "Adam")) # Should print 3

print(check_guests(guest_list, "Sakira")) # Should print 3

print(check_guests(guest_list, "Charley")) # Should print 2

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_2

Step: 3

blur-text-image_3

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 Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions

Question

=+ For what reasons can and do unions go on strike?

Answered: 1 week ago

Question

=+ Is secondary industrial action common and/or legal?

Answered: 1 week ago