from typing import Dict
from typing import Any
from typing import List


def set_user_defined_functions(
    fha: Dict[str, Any], functions: List[str]
) -> Dict[str, Any]:
    """Set the user-defined functions for the user-defined calculations.

    .. note:: by default we set the function equal to 0.0.  This prevents Sympy
        errors resulting from empty strings.

    :param fha: the functional hazard assessment dict.
    :param list functions: the list of functions; list items are str.
    :return: fha; the functional hazard assessment dict with updated functions.
    :rtype: dict
    """
    _key = ""
    for _idx in [6, 7, 8, 9, 10]:
        try:
            _key = list(fha.keys())[_idx]
            if str(functions[_idx - 6]) == "":
                fha[_key] = "0.0"
            else:
                fha[_key] = str(functions[_idx - 6])
        except IndexError:
            fha[_key] = "0.0"

    return fha