You are given a length of string and two thumbtacks. On thumbtack goes into the focus point *F₀* with coordinates *x₀* and *y₀*, and the other does into point *F₁* with points *x₁* and *y₁*. The string is then tied at the ends to the thumbtacks and has length *l* excluding the knots at the ends. If you pull the string taught with a pencil and draw around the plane you'll have an ellipse with focuses at *F₀* and *F₁*. Given a new point *P*, determine if it falls inside of the ellipse.

You must write a function that takes arguments `f0`, `f1`, `l`, and `p` and returns `true` or `false` depending on whether or not `p` falls inside the ellipse. 

Each of `f0`, `f1`, and `p` has has properties `x` and `y` for its coordinates.

You will never be given the case where the string is too short to reach between the points.

Difficulty: introductory

Starter code:

def ellipse_contains_point(f0, f1, l, p):
	

Solutions:
dist = lambda p1, p2: ((p1['x']-p2['x'])**2+(p1['y']-p2['y'])**2)**0.5
ellipse_contains_point = lambda f0, f1, l, p : dist(p, f0)+dist(p, f1)<=l

from math import hypot

def ellipse_contains_point(f0, f1, l, p): 
    d0 = hypot(f0["x"] - p["x"], f0["y"] - p["y"])
    d1 = hypot(f1["x"] - p["x"], f1["y"] - p["y"])
    return d0 + d1 <= l

import math

def ellipse_contains_point(f0, f1, l, p): 
    calc_len = lambda f: math.hypot(*(f[a] - p[a] for a in 'xy'))
    return calc_len(f0) + calc_len(f1) <= l

from math import sqrt


def ellipse_contains_point(f0, f1, l, p):
    return distance(f0, p) + distance(f1, p) <= l


def distance(p0, p1):
    return sqrt(pow(p0['x'] - p1['x'], 2) + pow(p0['y'] - p1['y'], 2))

from math import sqrt

def ellipse_contains_point(f0, f1, l, p): 
   # S = {'x' : (f0['x'] + f1['x']) / 2, 'y' : (f0['y'] + f1['y']) / 2}
    d1 = sqrt((f0['x'] - p['x'])**2 + (f0['y'] - p['y'])**2)
    d2 = sqrt((f1['x'] - p['x'])**2 + (f1['y'] - p['y'])**2)

    #dy = sqrt(f1['x']**2 + p['x']**2) + sqrt(f1['y']**2 + p['y']**2)
    return d1 + d2 <= l

import math
def ellipse_contains_point(f0, f1, l, p): 
    return (math.hypot(p['x'] - f0['x'],p['y'] - f0['y']) + math.hypot(p['x'] - f1['x'],p['y'] - f1['y'])) <= l

import math
def ellipse_contains_point(f0, f1, l, p): 
    def dist2d(p1, p2):
        return math.sqrt((p2['x'] - p1['x']) ** 2 + (p2['y'] - p1['y']) ** 2)
    return dist2d(p,f0) + dist2d(p,f1) <= l

def ellipse_contains_point(f0, f1, l, p): 
    return ((p['x']-f0['x'])**2+(p['y']-f0['y'])**2)**.5 + ((p['x']-f1['x'])**2+(p['y']-f1['y'])**2)**.5 <= l

def ellipse_contains_point(f0, f1, l, p): 
    x1, x2, y1, y2 = f0["x"] - p["x"], f1["x"] - p["x"], f0["y"] - p["y"], f1["y"] - p["y"]
    d1 = (x1**2+y1**2)**.5
    d2 = (x2**2+y2**2)**.5
    return d2 + d1 <= l

def ellipse_contains_point(f0, f1, l, p): 
    x1, x2, y1, y2 = f0['x'], f1['x'], f0['y'], f1['y']
    c = (((x1-x2)**2 + (y1-y2)**2)**.5)/2
    h, k = (x1 + x2)/2, (y1 + y2)/2
    a = c + (l-2*c)/2
    b = ((l/2)**2 - c)**.5
    return ((p['x'] - h)**2)/ a**2 + ((p['y'] - k)**2)/ b**2 <=1 and c<l/2.