def strip_comments(string, markers):
    """
    Complete the solution so that it strips all text that follows any of a set of comment markers passed in.
    Any whitespace at the end of the line should also be stripped out.
    :param string: a string input.
    :param markers: list of characters.
    :return: a new string with whitespace and comment markers removed.
    """
    parts = string.split("\n")
    for v in markers:
        parts = [x.split(v)[0].rstrip() for x in parts]
    return "\n".join(parts)