write a short python code segment that prints the longest word in a list of words.
Answers
Answered by
13
Answer:
mylist=["apple","banana","strawberry","guava"]
longest=""
for x in mylist:
if len(x)>len(longest):
longest=x
print(longest)
Explanation:
Hope it helps :-)
Answered by
2
Answer:
lst=eval(input("Enter the list of the words:"))
longest=""
for i in lst:
if len(i)>len(longest):
longest=i
print("Longest word in the list is:",longest)
Explanation:
Similar questions