#longest word of the sentence with its length sent=input("Enter sentence : ") words=sent.split() length=len(words[0]) for word in words: if length < len(word): longest=word length=len(word) print("The longest word is", longest, " and its length is ",length) Expected Output: Enter sentence : 'Developer of C++ language is Bjarne Stroustroup' ('The longest word is', 'Stroustroup', ' and its length is ', 11)