Question: Write a custom function in python and submit it: Accept one object as a parameter, but only a string. We will assume the string is

Write a custom function in python and submit it:

  • Accept one object as a parameter, but only a string. We will assume the string is a sentence or a paragraph, and our goal is to do some basic clean-up work for a data science project that analyzes the words used in online discussion threads.
  • If the object passed as a parameter is not a string return a message to that effect. Otherwise, use a string method the split the string by spaces so that the result is a list object with all of the words from the string.
  • The elements in the list must all be lowercase words, and you must strip out all commas that appeared in the original string. Don't worry about other punctuation.
  • If the object does not have any spaces, our assumptions about the object being a sentence or paragraph were wrong and your function should return a message to that effect. Otherwise, return the "cleaned up" list.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!