Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 onimage text in transcribedly up to tuples as a side note.image text in transcribed

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

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

Step: 3

blur-text-image

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

7. Where Do We Begin?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago