Python Find Longest Word || File Handling || Python
In this we are going to see a basic program to find longest word in a file in Python Programming Language.



def longest_word():
    f = open("file.txt", "r")
    words = f.read().split()
    f.close()
    longest = max(words, key=len)
    print(longest)

longest_word()

# Coded By Dhiraj Shelke


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post