-1

I want to when I input a string, if words in string is contain in a list of words, delete words in the strings

1 Answers1

1

Or, you could do the following:

raw_string = input("Enter String:")
useless_list = ["Birds", "Cat"]
print(' '.join([i for i in raw_string.split() if i not in useless_list]))
tgikal
  • 1,667
  • 1
  • 13
  • 27
Rushabh Mehta
  • 1,529
  • 1
  • 13
  • 29