Below is a simple piece of code that accepts 2 strings and removes all characters from the 2nd string which are present in the 1st string:
s1 = 'aeiou'
s2 = 'this is python program'
checkFor = []
for i in s1:
checkFor.append(i)
for i in s2:
if i in checkFor:
print(i)
s2.replace(i, '')
print(s2)
This is the output I'm getting:
i
i
o
o
a
this is python program
The if block is getting executed but why is the .replace() method not working? or is there a better way of deleting a character from a string?