Output for remove_stopwords is different

Hi,
I have a problem with my output of remove_stopwords.
I have no idea how to solve it…

Could anyone help me, please?

The expected output is correct. So, there is no mistake with the lab.
Please check if you are doing the following:

  1. Split sentence based on whitespace to produce a list of words
  2. For each word in this list, add it to a new list if it’s not a stopword
  3. Use string .join method to create and return a new sentence that’s void of stopwords.

Thank you for your response,
But when I tested to remove_stopwords I didn’t get any output :frowning:
How did it happen, sir?

If you code the function def remove_stopwords(sentence) correctly, the function should return sentence without any stopwords upon invoking with a sentence. Once you verify this behavior, please fix the code block that parses and populates processed labels and sentences.

when I updated the code to remove the stopwords I got this output

AttributeError Traceback (most recent call last)
in
1 # Test your function
2 text = “I am about to go to the store and get any snack”
----> 3 filtered_sentence = remove_stopwords(“I am about to go to the store and get any snack”)

in remove_stopwords(sentence)
13 for word in stopwords:
14 word = word.split(‘\n’)
—> 15 sentence.append(word[0])
16
17 remove_stopwords = [word for word in labels if word not in sentences]

AttributeError: ‘str’ object has no attribute ‘append’

what happened with it :disappointed_relieved:

This is basic python. You are trying to append an object to a string instead of appending to a list. Please fix it.

i reviewed the code and that’s what the error said
AttributeError: ‘list’ object has no attribute ‘words’

could you help me, sir :")

Please take some time to review the error. your previous post mentioned attribute not found error. list has append attribute but doesn’t have an attribute called words.