def hasdigit(s):
    '''
    Purpose: Check whether a string s contains any digits.
    Pre:  s is a string
    Post: returns True if s contains at least one digit,
          False otherwise.
    '''

    # An 'any' loop: set the flag to true if we find one.
    result = False
    for char in s:
        if char.isdigit():
            result = True
        # No else!
    return result

def main():
    # Driver program for hasdigit.

    # Sentinel logic loop
    userin = input("Enter a string or type 'quit': ")
    while userin != "quit":
        if hasdigit(userin):
            print("That string contains a digit.")
        else:
            print("That string does not contain a digit.")
        userin = input("Enter a string or type 'quit': ")

main()
