Q. Write a function stats() that accepts a filename and reports the file's longest line.
Answer :-
def stats (filename) : longest = "" for line in file(filename) : if len(line) > len(longest) : longest = line print("Longest line's length = ", len(longest)) print (longest)
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )