How to find the longest word in python ?

Last Updated On Monday 25th Apr 2022
  • Mapping every word in the list to the length function and returning the max of them
  • Then use the length of each word that matches the maximum word above

Code Example

	def longestWordCheck():

    words = ["hello", "world", "I", "am", "Longest", "Word"]

    maxWord = max(map(len, words))

    for word in words:

        if len(word) == maxWord:

if __name__ == "__main__":



	# Longest