''' Purpose: find the words of maximum length in user text ''' # get the words reply = input( 'Enter text: ' ) words = reply.split() # consider the words one by one to find a longest word longest_seen = "" # so far nothing has been seen for word in words : # consider each word in turn nw = len( word ) # get its length nl = len( longest_seen ) # get the length of the longest seen so far if ( nl < nw ) : # compare the two lengths longest_seen = word # if current word is longer, update longest seen # determine the words of longest length longest_words = [] # Initialize an empty list # See if the word has the length of the longest word # Add it to your longest_words list if it does! for word in words: # Go through your list of words again! if( len(word) == len( longest_seen) ): # is word as long as longest word? longest_words.append( word ) # Add the word to the list of longest words else: pass # do nothing if the lengths aren't equal # print result print( longest_words ) # List of my longest words! I need to build this list!