Write a short python code segment that print the longest word in the list of the word.

preview_player
Показать описание
Q. Write a short python code segment that print the longest word in the list of the word .

Website Link :-

Q 5 || Type C || Python revision tour 2 || Sumita Arora || Class 12 || Computer science || IP

Python revision tour 2 Playlist link ---

Answer :-

lst = eval(input ("Enter the list = "))
long = len ( lst [ 0 ])

for i in lst :
if long = len ( i ):
long = len ( i )
word = i

print ("longest word in list = " , word )

Output :-

Enter the list = ["Path","Walla","Portal","Express"]
longest word in list = Express

Enter the list = ["C++","Python","Java","CSS"]
longest word in list = Python
Рекомендации по теме
Комментарии
Автор

bhai chhota bada kya bol rha hai kuchh samajh nhi aa rha

sakshambajpai
join shbcf.ru