Im in the middle of designing a game in python, im quite new to using it and am 
struggling with a certain bit of code. I want to have a function that will 
ignore certain words that i have specified in a dictionary. I have tried so 
many different types of code but can't seem to return just the keywords i want.

the dictionary is called skip_words and has about 20 different strings in.

so far i came up with:

def filter_words(words, skip_words):

       word = words.strip(skip_words)

       return word

The function should read an input such as help me please and filter out the 
words "please" and "me" as they are in the dictionary and just return the word 
help as the input.

>>>filter_words(["help", "me", "please"], ["me", "please"])


That doesn't work but i just assume it is a very simple bit of code.

any suggestions of a way that works?

Thanks:) T
Tutor maillist  -
To unsubscribe or change subscription options:

Reply via email to