Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

longest word in str

def longestWord(some_list): 
    count = 0    #You set the count to 0
    for i in some_list: # Go through the whole list
        if len(i) > count: #Checking for the longest word(string)
            count = len(i)
            word = i
    return ("the longest string is " + word)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #longest #word #str
ADD COMMENT
Topic
Name
4+9 =