What's wrong with:
def project_to_distance(point_x, point_y, distance):

 dist_to_origin = math.square_root(point_x ** 2 + point_y ** 2)    


 scale = distance / dist_to_origin
temp1= point_x * scale
temp2= point_y * scale

print temp1, temp2

print project_to_distance(2, 7, 4)

Usually a point is given by its x, y coordinates.

Hint:

def get_distance(x1, y1, x2, y2):
    """
    get_distance(x1, y1, x2, y2)
    returns distance between two points using the pythagorean theorem
    the function parameters are the coordinates of the two points
    """
    dx = x2 - x1
    dy = y2 - y1
    distance = (dx**2 + dy**2)**0.5
    return distance
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.