Python: Remove words from a given list of strings containing a character or string
Remove Words Containing Specific Characters
Write a Python program to remove words from a given list of strings containing a character or string.
Sample Solution:
Python Code:
Sample Output:
Original list: list1: ['Red color', 'Orange#', 'Green', 'Orange @', 'White'] Character list: ['#', 'color', '@'] New list: ['Red', '', 'Green', 'Orange', 'White']
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Python program to remove words containing numbers.
- Write a Python program to remove words with special characters.
- Write a Python program to filter words based on multiple conditions.
- Write a Python program to replace unwanted words with placeholders.
Go to:
Previous: Write a Python program to interleave multiple lists of the same length.
Next: Write a Python program to calculate the sum of the numbers in a list between the indices of a specified range.
Python Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.