Manipulate Data in a List

  1. After you create a list to store points (as specified in the previous exercise), print out the list after sorting by

The program may run as follows:


Enter the name of the data file: hw11.dat
Original List:
(1,2) 2.23606797749979
(2,7) 7.280109889280518
(3,4) 5.0
(12,5) 13.0
(6,8) 10.0

Sorted by X:
(1,2) 2.23606797749979
(2,7) 7.280109889280518
(3,4) 5.0
(6,8) 10.0
(12,5) 13.0

Sorted by Y:
(1,2) 2.23606797749979
(3,4) 5.0
(12,5) 13.0
(2,7) 7.280109889280518
(6,8) 10.0

Sorted by distance:
(1,2) 2.23606797749979
(3,4) 5.0
(2,7) 7.280109889280518
(6,8) 10.0
(12,5) 13.0