''' Purpose: introduce looping. the program processes the words in a string one-by-one. ''' # get name text = input( "Enter name: " ) print() # split the text into a list of words list_of_words = text.split() print( 'List of words: ', list_of_words ) print() # print the words in list_of_words accompanied by their lengths print( 'Loop starting' ) for current_word in list_of_words : print( 'Loop variable: ', current_word ) # print out the current_word loop variable value (word from the list) # process the current word length_of_current_word = len( current_word ) # determine current word length print( current_word, ':', length_of_current_word ) # print wanted info print( 'All done with loop variable: ', current_word ) print( 'Loop done' )