Menu

Python Program Write Program Reads File Named Namestxt Names People Form X Ben Y X Bent Y Q43779136

Python Program

Write a program that reads from a file named “Names.txt” thenames of people in the form of “X ben Y” or “X bent Y”. In otherwords, 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 toanalyze them and come up with a list that starts with theGrand-grand father followed by his sons and daughters and then hisgrand-sons and/or grand-daughters.
For example, if the “Names.txt” file contained the followingentries:
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

Expert Answer


Answer to 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 …

OR