Login
|
Signup
langref.org
-
python
add..
all
clojure
cpp
csharp
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Numbers
Mathematical
Find the distance between two points
python
# problem description doesn't say 2D points ;)
from math import sqrt
print sqrt(sum((x-y)**2 for x,y in zip(a, b)))
# problem description doesn't say 2D points ;)
from math import sqrt
print sqrt(sum((x-y)**2 for x,y in zip(a, b)))
python
from math import hypot
print hypot(x2-x1, y2-y1)
from math import hypot
print hypot(x2-x1, y2-y1)
Submit a new solution for
python
There are 24 other solutions in
additional
languages (
clojure
,
cpp
,
csharp
,
erlang
...)