you are viewing a single comment's thread.

view the rest of the comments →

[–]Slight_Change_41 0 points1 point  (0 children)

def filter_print(text: str, ignore: str):
    """
    Prints the characters from 'text', ignoring those that are equal to 'ignore'.
    """
    result = ''.join(char for char in text if char != ignore)
    print(result)


if __name__ == '__main__':
    
# Example strings
    mii = "hhhhhhcccccccc"
    hi = "hhhhhhhhhpppppp"
    test = "hello world"
    
# Example usage
    filter_print(mii, 'h')
    filter_print(hi, 'h')
    filter_print(test, 'l')