A program in python to read string and print the longest word and its position?
Here we’ll see how to find the longest word in the given string.
e.g.,
sentence = input("Enter sentence: ") l = max(sentence.split(), key=len) print(l) print(len(l))
This is how we can find the longest word in the string.
Subscribe
Login
Please login to comment
0 Discussion