(f, K=None, zero=False)
return result
Convert ``K[x]`` polynomial to a ``dict``.

    Examples
    ========

    >>> from sympy.polys.densebasic import dup_to_dict

    >>> dup_to_dict([1, 0, 5, 0, 7])
    {(0,): 7, (2,): 5, (4,): 1}
    >>> dup_to_dict([])
    {}
Convert ``K[x]`` polynomial to a ``dict``.
Convert K [ x ] polynomial to a dict .
def dup_to_dict(f, K=None, zero=False):
    """
    Convert ``K[x]`` polynomial to a ``dict``.

    Examples
    ========

    >>> from sympy.polys.densebasic import dup_to_dict

    >>> dup_to_dict([1, 0, 5, 0, 7])
    {(0,): 7, (2,): 5, (4,): 1}
    >>> dup_to_dict([])
    {}

    """
    if not f and zero:
        return {(0,): K.zero}

    n, result = len(f) - 1, {}

    for k in xrange(0, n + 1):
        if f[n - k]:
            result[(k,)] = f[n - k]

    return result
def dup_to_dict ( f , K = None , zero = False ) : if not f and zero : return { ( 0 , ) : K . zero } n , result = len ( f ) - 1 , { } for k in xrange ( 0 , n + 1 ) : if f [ n - k ] : result [ ( k , ) ] = f [ n - k ] return result