[Tutor] Error checking - very basic question

Garry Rowberry big.gaz at dsl.pipex.com
Sun Sep 25 12:53:37 CEST 2005

I have a call which needs to reply 2.1 or 2.8 and report an error if not:

def ask_dau_version():
    """Determine the product issue of the DAU."""
    dau_version = None
    while dau_version not in ("2.8", "2.1"):
        dau_version = raw_input("\n\tIs the DAU a version 2.1 or 2.8, please
enter only 2.1 or 2.8 ")
        print"\n\t\aError! - please enter only 2.1 or 2.8."
    return dau_version

I can see why it isn't working, the error message is in the wrong place, but
I can't see a simple way around it (wood for the trees)


More information about the Tutor mailing list