How about use the built-in dist() function?