Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started