Skip to content

Commit 363ff3f

Browse files
committed
extension challenge complete: word length checker
1 parent f65a064 commit 363ff3f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

040_challenge_1_exercise.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,23 @@
3030
print("Function: report_long_words")
3131

3232
def report_long_words(words):
33-
pass
33+
long_words_list = []
34+
35+
for word in words:
36+
37+
if len(word) >= 10 and "-" not in word:
38+
if len(word) >= 15:
39+
word = word[:15] + "..."
40+
long_words_list.append(word)
41+
42+
if long_words_list:
43+
return "These words are quite long: " + ", ".join(long_words_list)
44+
else:
45+
return "These words are quite long: "
46+
47+
48+
49+
3450

3551
check_that_these_are_equal(
3652
report_long_words([

0 commit comments

Comments
 (0)