Question: writing a code for the given problem. I have learned on ly up to tuples as a side note. Ancestors Function Name: ancestors() Parameters: list

writing a code for the given problem. I have learned onwriting a code for the given problem. I have learned only uply up to tuples as a side note.to tuples as a side note. Ancestors Function Name: ancestors() Parameters: list

Ancestors Function Name: ancestors() Parameters: list of names ( list ), surname ( str) Returns: matching names ( list) Description: Seeing people participate in mail-in DNA ancestry tests lately, you have decided you want to participate, but you would rather save money and code your own test. Write a function that takes in a list of names and a specific surname to search for. Return a list of the first names of all the names in the original list that have the correct surname AND do not have middle names. There should be no repeats in the returned list. It should be case-sensitive ("Yap" is not the same surname as "yap"). >>> names = ["Damian Henry", "Henry Ford", "Warren Elliot Henry", "Heather Fren ch Henry"] >>> surname = "Henry" >>> print (ancestors(names, surname)). ['Damian'] >>> names = ["Kim Kardashian West", "Kylie Jenner", "Kourtney Mary Kardashian", "Jasmine Kardashian", "Brae Kardashian", "Jasmine Kardashain"] >>> surname = "Kardashian" >>> print (ancestors (names, surname)) ['Jasmine', 'Brae'] Ancestors Function Name: ancestors() Parameters: list of names ( list ), surname ( str) Returns: matching names ( list) Description: Seeing people participate in mail-in DNA ancestry tests lately, you have decided you want to participate, but you would rather save money and code your own test. Write a function that takes in a list of names and a specific surname to search for. Return a list of the first names of all the names in the original list that have the correct surname AND do not have middle names. There should be no repeats in the returned list. It should be case-sensitive ("Yap" is not the same surname as "yap"). >>> names = ["Damian Henry", "Henry Ford", "Warren Elliot Henry", "Heather Fren ch Henry"] >>> surname = "Henry" >>> print (ancestors(names, surname)). ['Damian'] >>> names = ["Kim Kardashian West", "Kylie Jenner", "Kourtney Mary Kardashian", "Jasmine Kardashian", "Brae Kardashian", "Jasmine Kardashain"] >>> surname = "Kardashian" >>> print (ancestors (names, surname)) ['Jasmine', 'Brae']

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!