Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def r(l):
- def x(i):
- return l[i][0]
- def y(i):
- return l[i][1]
- xs = [x(i) for i in range(len(l))]
- ys = [y(i) for i in range(len(l))]
- r = (
- (len(l) * sum([x(i) * y(i) for i in range(len(l))]))
- - (sum(xs) * sum(ys))
- ) / ((
- (
- len(l) * sum([x(i) ** 2 for i in range(len(l))])
- - (sum(xs) ** 2)
- ) * (
- len(l) * sum([y(i) ** 2 for i in range(len(l))])
- - (sum(ys) ** 2)
- )
- ) ** 0.5)
- return r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement