Help code developing (geopy.distance.great_circle)

I am new to python and asked to finish a code.
I need to define a function named Cal_Distance(self) which returns the distance of the whole trajectory in meter. Use a for loop to traverse all trajectory points to calculate the great-circle distance between each two consecutive points, then sum them up and return total distance of the whole trajectory.

Here is my code.

        def Cal_Distance(self):
        import geopy.distance as geo
        for x in
                point1_lat =[x][0]
                point2_lat =[x+1][0]
                point1_lon =[x][1]
                point2_lon =[x+1][1]
                point_start = (point1_lat, point1_lon)
                point_end = (point2_lat, point2_lon)

                dis = geo.great_circle(point_start, point_end).meters

        return dis

The is like this

[[39.99473, 116.3075133, 236.2, '2009-04-14', '07:33:07'], [39.9947383, 116.3075199, 246.1, '2009-04-14', '07:33:08'], [39.9947099, 116.3074466, 328.1, '2009-04-14', '07:33:11']]

I cannot run the for loop and calculate the distance.
The error keeps show up like this
TypeError: list indices must be integers or slices, not list

How can I solve the problem and improve the code.
Thanks a lot.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.