Question: This is the code i wrote so far. But, when it computes differently and it was wrong. How do i write the code for this

 This is the code i wrote so far. But, when it

This is the code i wrote so far. But, when it computes differently and it was wrong. How do i write the code for this python problem?

(note: i have only learned up to tuples)

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!