Question
the following contains information about some Lebanese citizens that contains their first name, last name, gender, city of registration, and registration number. Peter, Haddad, M,
the following contains information about some Lebanese citizens that contains their first name, last name, gender, city of registration, and registration number.
Peter, Haddad, M, Dekweneh, 5100
Petra, Yahya, Haddad, F, Jbeil, 4321
Walid, Khaled, M, Beirut, 1726
Sako, Kazanjian, M, Ain Ebel, 1121
Patrick, Haddad, M, Dekweneh, 5100
Joseph, Yahya, M, Jounieh, 36
Zoulaykha, Haddad, F, Dekweneh, 5100
Marina, Saadeh, Haddad, F, Chwaifet, 1819
Rami, Saad, M, Jbeil, 4321
Bernard, Khaled, M, Beirut, 1726
Charbel, Kazanjian, M, Ain Ebel, 1121
Cynthia, Khaled, F, Beirut, 1726
Najib, Mansour, M, Beirut, 1726
Entries about female citizens contain next to their last maiden name, their last marital name. Your job is to process this information such that all the members of the same family appear together on the same line in an output file called out.txt. Each line in the output file starts with the family last name followed by its members first names e.g. Khaled: Walid, Bernard Kazanjian: Sako, Charbel The most reliable indicators that you can use to figure out the members of the same family are the city of registration and the register number. Some lines contain erroneous information i.e. although a member has the same registration city and registration number as other members of the same family, yet, by mistake his/her last name does not match that of the other members e.g. Najib Mansours last name must have been Khaled. Save all erroneous entries (i.e. copy the whole line from file) to another output file named errors.txt.
I need the program written in python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started