Write a function stats() that accepts a file name and reports the file's longest line.
Answers
Answered by
20
Answer:
def stats(x):
myf=open(x)
f = myf.readlines()
longest=""
for i in f :
if len(i) > len(longest) :
longest=i
print("longest line is :",longest)
#main
m=input("enter file name")
n=stats(m)
Answered by
17
Language using: Python Programming
function stats() that accepts a filename and reports the file;’s longest line.
Program:
def stats(f):
long=""
for i in f:
if len(i)>len(long):
long=i
print(long)
stats(open('brainly.txt','r'))
Learn more:
1) Printing all the palindromes formed by a palindrome word.
brainly.in/question/19151384
2) Indentation is must in python. Know more about it at :
brainly.in/question/17731168
Similar questions