riverA = [[3,7], [3,9], [4,11], [6,12]] riverB = [[12,4], [10,6], [6,7], [3,9], [2,4]] riverC = [[12,4], [3,9], [2,4], [4,11]] # Part 1 – more atomic way to define calculateLength() def distance(a, b): return ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** 0.5 def calculateLength(line): length = 0 for i in range(len(line) - 1): length += distance(line[i], line[i+1]) return length # Part 1 – all in one function def calculateLength(line): length = 0 for i in range(len(line) - 1): length += ((line[i][0] - line[i+1][0]) ** 2 + (line[i][1] - line[i+1][1]) ** 2) ** 0.5 return length # Part 2 def findCommonPoints(line1, line2): commonPoints = [] for point in line1: if point in line2: commonPoints.append(point) return commonPoints