(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