def real(prompt=None, empty=False):
s = _prompt_input(prompt)<EOL>if empty and not s:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>return float(s)<EOL><DEDENT>except ValueError:<EOL><INDENT>return real(prompt=prompt, empty=empty)<EOL><DEDENT><DEDENT>
Prompt a real number.

    Parameters
    ----------
    prompt : str, optional
        Use an alternative prompt.
    empty : bool, optional
        Allow an empty response.

    Returns
    -------
    float or None
        A float if the user entered a valid real number.
        None if the user pressed only Enter and ``empty`` was True.