Skip to main content

Python 2, 4847 bytes

A straight forward solution. The function expects 2 points as sequences of numbers, and returns the distance between them.

lambda a,b:sum((d-e)**2for d,e in zip(a,b))**.5 

Example:

>>> f([13.37, 2, 6, -7], [1.2, 3.4, -5.6, 7.89]) 22.50202213135522 

Python 2, 48 bytes

A straight forward solution. The function expects 2 points as sequences of numbers, and returns the distance between them.

lambda a,b:sum((d-e)**2for d,e in zip(a,b))**.5 

Example:

>>> f([13.37,2,6,-7], [1.2,3.4,-5.6,7.89]) 22.50202213135522 

Python 2, 47 bytes

A straight forward solution. The function expects 2 points as sequences of numbers, and returns the distance between them.

lambda a,b:sum((d-e)**2for d,e in zip(a,b))**.5 

Example:

>>> f([13.37, 2, 6, -7], [1.2, 3.4, -5.6, 7.89]) 22.50202213135522 
Source Link
Logic Knight
  • 6.8k
  • 1
  • 19
  • 51

Python 2, 48 bytes

A straight forward solution. The function expects 2 points as sequences of numbers, and returns the distance between them.

lambda a,b:sum((d-e)**2for d,e in zip(a,b))**.5 

Example:

>>> f([13.37,2,6,-7], [1.2,3.4,-5.6,7.89]) 22.50202213135522