#makeList.py  interactive loops -- (1) without sentinal and (2) with sentinal

def listLoop1():  # explicit question each time
    words = []                                # initialize
    ans = raw_input("More words? (y or n): ")  # prime the loop
    while ans == 'y':
        word = raw_input("Next word: ")
        words.append(word)
        ans = raw_input("More words? (y or n): ") # ready for next time --
                                                 #   a repeat of the prompt!

    print "Thank you!  The word list is: "
    print words
    
def listLoop2():  # with empty line sentinal
    words = []                                # initialize
    word = raw_input("Next word (or enter to quit): ") # first before the loop
    while word != '':  # or>>    while word:  (empty sequence is false)
        words.append(word)
        word = raw_input("Next word (or enter to quit): ") # again repeat prompt

    print "Thank you!  The word list is: "
    print words
    
listLoop1()
listLoop2()
