Ask Question
22 February, 05:44

Define a function called strip_punctuation which takes one parameter, a string which represents a word, and removes characters considered punctuation from everywhere in the word. (Hint: remember the. replace () method for strings.) punctuation_chars = ["'", '"', ",", ".", "!", ":", "; ", '#', '@']

+3
Answers (1)
  1. 22 February, 06:01
    0
    punctuation_chars = ["'", '"', ",", ".", "!", ":", "; ", '#', '@']

    def strip_punctuation (strWord):

    for charPunct in punctuation_chars:

    strWord = strWord. replace (charPunct, "")

    return strWord

    Explanation:

    The function is defined with a single argument.

    A for loop is ran to check each character of the the word.

    If a punction mark is present as a character in the word, it is removed.

    The same word is returned but without the punctuation marks.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Define a function called strip_punctuation which takes one parameter, a string which represents a word, and removes characters considered ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers