def createCoordsPairs(l): coordsPairs = [] for i in xrange(0, len(l)): coordsPairs.append([l[i], l[(i + 2) % len(l)]]) return coordsPairs