from typing import Iterable
from typing import Any


def rangdict(r: Iterable, value: Any = "") -> dict:
    """Constructs a dictionary with the given range

    Parameters:
        r (iterable): the range to use for keys
        value (any) -> "": the default value to use

    Returns:
        result (dict): a dict made using the range

    Example:
        .rangdict(range(5))

        Returns:
            {1: 1, 2: 2, 3: 3, 4: 4}

        If `value` is anything other than `""`, it
        will be used for the value of each key.
    """
    nd = {}
    for i in r:
        nd[i] = value.replace("%i", str(i)) or i

    return nd