Hey guys, can you help in one program? I don't have any idea about this program. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hey guys, can you help in one program? I don't have any idea about this program.

Write a python function to remove a given word from a string and strip it at the same time.

29th Nov 2022, 6:56 AM
Anonymous
Anonymous - avatar
1 Answer
+ 3
You can use the split function to create a list of words from a string. You can use the filter function, or a list comprehension with a condition, to get only those words which don't match the given word. You can use the join function to combine the remaining words to a single string.
29th Nov 2022, 7:15 AM
Tibor Santa
Tibor Santa - avatar