We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d39927 commit 8b084f9Copy full SHA for 8b084f9
Lab Cycle 2/program17.py
@@ -0,0 +1,14 @@
1
+# Program to accept a list of words and return the length of the longest word.
2
+
3
+def longest_word(words):
4
+ longest = 0
5
+ for word in words:
6
+ if len(word) > longest:
7
+ longest = len(word)
8
+ longest_word = word
9
+ print("Longest word is",longest_word)
10
+ print("Length of longest word is",longest)
11
12
+print("Enter a list of words separated by spaces: ")
13
+words = input().split()
14
+longest_word(words)
0 commit comments