Question: Python language please! The file flights txt contains data about travellers and the countries they have visited. Each line in the file consists of a

 Python language please! The file flights txt contains data about travellersand the countries they have visited. Each line in the file consists

Python language please!

The file flights txt contains data about travellers and the countries they have visited. Each line in the file consists of a the traveller's name and the country he/she has visited The data in the file has the following format: John SWEDEN Mary NORWAY John ENGLAND John ICELAND Phil CHINA Mary NORWAY Mary ICELAND Each line holds the name of a traveller and a country the traveller has visited. The name and the country are seperated by a single space. Note that no traveller has the same name and each traveller may have visited many countries and even the same country more than once. Write a Python program which reads information from the file flights.txt and does the following Prints the names of each traveller in alphabetical order .For each traveller, prints a list of all the countries he/she has travelled to in alphabetical order .Prints the name of the traveller who has travelled to most contries and the number of countries he/she has travelled to. NOTE: If many travellers have travelled to the same number of countries you should print the first one of theml based on their names in alphabetical order) Each traveller should be printed in the following format The name of the traveller followed by a colon. Then each country in a separate line prefixed with a tab character [t Example output: John: ENGLAND ICELAND SWEDEN Mary: ICELAND NORWAY Phil: CHINA John has been to 3 countries

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!