daily pastebin goal


a guest Mar 13th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def getWords():
  2.     ''' Creates a list from words recieved from the user until the user states he is finished by entering the keyword. Returns the created list '''
  3.     wordlist = []
  4.     print "What words would you like in the list? Note that any line that contains the word \"zebra\" will not be included in the list. When finished enter ZeBrA."
  5.     getwords = raw_input("Please enter the words you would like in your word list. ")
  6.     while getwords != "ZeBrA":
  7.         """splitwords = getwords.split()
  8.        print splitwords
  9.        wordlist.append(splitwords)"""
  10.         wordlist.append(getwords)
  11.         getwords = raw_input("Enter some more words (or ZeBrA to stop) ")
  12.     for x in wordlist:
  13.         print wordlist
  14.         #for y in splitwords:
  15.         if x == "zebra":
  16.             wordlist.remove(x)
  18.     print wordlist
  19. getWords()
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