SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. This Python function takes in a list of words (all_words) and a prefix and returns
  2.  a new list of words (words_with_prefix) containing all the words in that list starting
  3.  with the specified prefix.
  4.  """
  5.  def get_words_with_prefix(all_words, prefix):
  6.      words_with_prefix = None
  7.      for word in all_words:
  8.          if word[0:len(prefix) - 1] is prefix:
  9.              words_with_prefix += word
  10.      return words_with_prefix
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top