I need to make a function that takes two lines as imnput and returns a copy of str 1 with all characters from str2 deleted.
First of all, you need to iterate over str1 with a for loop, and then compare with str2 to do the subtraction. I have to create a third line in which the output will be saved, but after that I lost a little.
def filter_string(str1, str2): str3 = str1 for character in str1: if character in str2: str3 = str1 - str2 return str3
This is what I played with, but I donβt understand how I should act.
source share