Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python Function Name: find_me Parameters: a dictionary of strings mapping to strings ( dict ), person1 ( str), person2 (str) Returns: number of people in

python

image text in transcribedimage text in transcribed

Function Name: find_me Parameters: a dictionary of strings mapping to strings ( dict ), person1 ( str), person2 (str) Returns: number of people in between the first and last person ( int ) Description: Given a dictionary and two names, find the number of people in between them. The dictionary maps a person ( key ) to the person ( value ) in front of them in a line. If person2 is the value of the personi key, then they have 0 people in between them. If there is no path between the two people, return None. Hint: A while loop to check if the current person you are on is actually in the dictionary might be helpful. However, this also can be done with a for loop. You pick! Test Cases V >>> people = {"Damian": "Jakob", "Rajit": "Jasmine Y.", "Jasmine Y.": "Arvin", "Caitlin": "Cathy", "Jakob": "Caitlin"} >>> person1 = "Damian" >>> person2 = "Cathy" >>> print (find_me (people, personi, person2)) V V # "Damian" -> "Jakob" -> "Caitlin" -> "Cathy" >>> people = {"Arushi": "Juliette", "Brae": "Arushi", "Anthony" : "Jasmine C." A A A >>> person1 = "Brae" >>> person2 = "Jasmine C.". >>> print (find_me (people, personi, person2)) None # "Brae" -> "Arushi" -> "Juliette" -/> oh no, the path is broken

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions