Guest User

Untitled

a guest
Mar 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  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)
  17.                
  18.     print wordlist
  19. getWords()
Add Comment
Please, Sign In to add comment