Q. Write a program to input a line of text and print the biggest word (length wise) from it.

Answer = 

sen = input("Enter the sentence :-")
lst = sen.split()
for i in range (len (lst)):
    for j in range (len(lst) -1):
        if len(lst[ j ]) > len(lst[j+1]):
            lst[ j + 1 ], lst[ j ] = lst[ j ], lst[j+1]
            
print("Longest word =", lst[-1])

Output :

Enter the sentence :- This Path Walla Website which helps you in Computers science
Longest word = Computers

>>>

9 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post