import math

# Function Design Recipe
# 1. Examples - example calls to the function with arugments and return values; choose the name of the function
# 2. Header - name of function, parameter names, type contract
# 3. Description - human language, says what the function does/returns (but not *how* it does it)
# 4. Body - the code that makes the function work
# 5. TESTING! (which can you do in the shell)

# Write a function that takes an (x,y) coordinate and returns
# the distnace from that point to the origin

# Note: x and y are usually not good parameter names, but here
# they're ok because of the context in math

def distance_from_origin(x: float, y: float) -> float:
    """Return the distance of point (x,y) from the origin.
    
    >>> distance_from_origin(3.0, 4.0)
    5.0
    >>> distance_from_origin(0.0, 0.0)
    0.0
    >>> distance_from_origin(1.0, 1.0)
    1.4142135623730951
    """
    
    return (x ** 2 + y ** 2) ** 0.5
    #return math.sqrt(x ** 2 + y ** 2)