3 回答
TA贡献1877条经验 获得超1个赞
Houses = [0]*(1000)
Houses[0], Houses[1] = [143.5689855, -38.328956999999996], [143.5692555, -38.328993]
for i in range(2, 1000):
latitude_diff = Houses[i-1][0] - Houses[i-2][0]
longitude_diff= Houses[i-1][1] - Houses[i-2][1]
temp = [Houses[i-1][0]+latitude_diff, Houses[i-1][1]+longitude_diff]
Houses[i] = temp
试试这个:)
TA贡献1815条经验 获得超13个赞
所以house_3纬度是纬度,house_4纬度是House_2[0]+1* latitude_diffHouse_2[0] + 2 * latitude_diff
所以你可以做一个列表理解 -
houses = [House_1, House_2]
for i in range(1, num_houses):
curr_house = [House_2[0] + i* latitude_diff, House_2[1] + i* longitude_diff]
pprint.pprint(curr_house)
houses.append(curr_house)
TA贡献1836条经验 获得超4个赞
添加回答
举报