Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a2 = 'Hello my name is sofiene'
- b2 = ['Hello', 'is']
- for item in b2: # Iterates through words in b2 using 'item' at iterator
- replace_words2 = a2.replace(item, '') # searches string for each word and replaces it with nothing
- a2 = replace_words2 # Redefines a2 after being modified with replace
- print(a2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement