World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Open a text file from PC and find the longest word in the text file and find the length.
def longest_word(filename): with open(filename, 'r') as infile: words = infile.read().split() max_len = len(max(words, key = len)) return [word for word in words if len(word) == max_len] print(longest_word('Your_file_name.txt'))
Running random forest algorithm with one variable