Skip to content

Instantly share code, notes, and snippets.

@hector117
Created March 30, 2017 19:27
Show Gist options
  • Save hector117/890e24cfbe6095c1d3fa04fa54c04ff2 to your computer and use it in GitHub Desktop.
Save hector117/890e24cfbe6095c1d3fa04fa54c04ff2 to your computer and use it in GitHub Desktop.
from math import sqrt
def distance (x1,x2,y1,y2):
distancia1 = sqrt(x1*x1 + y1*y1)
distancia2 = sqrt(x2*x2 + y2*y2)
tupla = (distancia1, distancia2)
return tupla
#main program below
print("Problema 1")
print("Ingresa x1")
x1 = float(input())
print("Ingresa x2")
x2 = float(input())
print("Ingresa y1")
y1 = float(input())
print("Ingresa y2")
y2 = float(input())
a = distance (x1,x2,y1,y2)[0]
b = distance (x1,x2,y1,y2)[1]
print("La distancia entre X1 y Y1 es de %1f y entre X2 y Y2 es de %1f " %(a,b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment