Question: Python Program Write a program that reads from a file named Names.txt the names of people in the form of X ben Y or X

Python Program

Write a program that reads from a file named "Names.txt" the names of people in the form of "X ben Y" or "X bent Y". In other words, we're talking about X being the son or the daughter of Y. The file will contain a number of such entries. Your job is to analyze them and come up with a list that starts with the Grand-grand father followed by his sons and daughters and then his grand-sons and/or grand-daughters. For example, if the "Names.txt" file contained the following entries: A ben B B ben C D ben A E ben A F ben E

then your program should output the following file named "Tree.txt": C B A D, E F

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!