Code Challenges on Irrelevant Text Data

Assess your ability to handle irrelevant text data using Python.

Challenge 1: Special characters, numbers, and punctuation

We’ve imported the re library and declared a text variable that contains a string. Write code containing a Python function with the name remove_special_chars that takes in the string as input and removes all special characters and punctuation marks from it, leaving only the letters of the alphabet and spaces. It should return the cleaned text.

Get hands-on with 1200+ tech skills courses.