def maclaurin_sin(value,k):
    """
    Compute maclaurin's series approximation for sin(x)
    """
    
    global first_value    
    first_value = 0.0

    #attempt to Approximate sin(x) for a given value    
    try:
        for item in xrange(1,k,4):
            next_value = (value*pi/180)**item/factorial(item)
            first_value += next_value
            
        for item in xrange(3,k,4):
            next_value = -1*(value*pi/180)**item/factorial(item)
            first_value += next_value
            
        return first_value
    
    #Raise TypeError if input is not a number
    except TypeError:
        print 'Please enter an integer or a float value'

    Compute maclaurin's series approximation for sin(x)
    
recipes/Python/577287_Maclaurinsseriessin_/recipe-577287.py