Question: Language is Python 3.6 Function name: find_family Parameters: names_list (a list of strings); surname (string) Return value: a list containing the first names of all

 Language is Python 3.6 Function name: find_family Parameters: names_list (a list

Language is Python 3.6

Function name: find_family Parameters: names_list (a list of strings); surname (string) Return value: a list containing the first names of all the people that have surname AND do not have middle names. Description: Write a function that takes in a list of names and a specific surname to search for. Return a list of the UNIQUE first names of all the names in names_list that have surname AND do not have middle names. NOTE: Each name could have 0 or more middle names, but all names have a first and last name. Test Cases: names_1 ["Josh Washington", "Chris Hartley", "Sam Giddings", "Beth Washington", "Jessica Riley" "Ashley Brown", "Hannah Washington", "Mike Munroe", "Matt Taylor", "Emily Davis"] >>> family-1 = find-family(names-1, "nashington") >>> print(family 1) [ 'Josh', 'Beth', 'Hannah'] >>> names-2 = ["Esteban Julio Ricardo Montoya de la Rosa Ramirez", "Lina Ramirez", "Sebastian Alejandro Ramirez", "Zack Martin", "Cody Martin", "Jonathan Romero", "Daniela Ramirez"] >>> family-2 -find-family(names-2, "Ramirez") >>> print (family_2) [ 'Lina', 'Daniela'] >names_3 ["John Roberts", "Anthony Kennedy", "Clarence Thomas", "Ruth Bader Ginsburg", "Stephen Breyer", "Samuel Alito", "Sonia Sotomayor", "Elena Kagan", "Neil Gorsuch"] >>> family-3 = find-family(names-3, "O'Connor") >print(family 3)

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!