CBSE BOARD XII, asked by mnandhinidevi3427, 11 months ago

write a short python code segment that prints the longest word in a list of words.

Answers

Answered by sswaraj04
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 prakharagrawal6055
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