Central City Given Set Cities Central Point City Shortest Total Distance Cities Write Prog Q37169819

(Central city)

Given a set of cities, the central point is the city that hasthe shortest total distance to all other cities. Write a programthat prompts the user to enter the number of the cities and thelocations of the cities (that is, their coordinates), and finds thecentral city. Note that the coordinates are entered in oneline.

Sample Run

Enter the coordinates of the cities: 2.5 5 5.1 3 1 9 5.4 54 5.52.1

The central city is at (2.5, 5).

In Python.


Answer


def distance(cities, i): total = 0 for j in range(len(cities)):

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.