Question::
Write a function
Code::
def longest(l):
long=0
word=""
for j in l:
if(long<len(j)):
long=len(j)
word=j
return [word,long]
n=input("Enter words:")
nt=n.split(",")
long=longest(nt)
print("Longest Word with length:",long)
Output::
Write a function
find_longest_word()
that takes a list of words and returns the length of the longest oneCode::
def longest(l):
long=0
word=""
for j in l:
if(long<len(j)):
long=len(j)
word=j
return [word,long]
n=input("Enter words:")
nt=n.split(",")
long=longest(nt)
print("Longest Word with length:",long)
Output::