def is_time(string):
    """Returns whether a string represents a time.

    Inputs:
        string (str): String to check.

    Returns:
        Whether the string represents a time.
    """
    if string.endswith("am") or string.endswith("pm"):
        if string[:-2].isdigit():
            return True

    return False