KnowledgeBoat Logo

Computer Science

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

Python

Python String Manipulation

28 Likes

Answer

str = input("Enter a string: ")
words = str.split()
longWord = ''

for w in words :
    if len(w) > len(longWord) :
        longWord = w

print("Longest Word =", longWord)

Output

Enter a string: TATA FOOTBALL ACADEMY WILL PLAY AGAINST MOHAN BAGAN
Longest Word = FOOTBALL

Answered By

13 Likes


Related Questions