Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This Python function takes in a list of words (all_words) and a prefix and returns
- a new list of words (words_with_prefix) containing all the words in that list starting
- with the specified prefix.
- """
- def get_words_with_prefix(all_words, prefix):
- words_with_prefix = None
- for word in all_words:
- if word[0:len(prefix) - 1] is prefix:
- words_with_prefix += word
- return words_with_prefix
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement