Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions