MCPcopy Create free account
hub / github.com/geekcomputers/Python / display_words

Function display_words

file_handle/File handle text/question 2.py:9–24  ·  view source on GitHub ↗
(file_path)

Source from the content-addressed store, hash-verified

7
8
9def display_words(file_path):
10 try:
11 with open(file_path) as F:
12 words = F.read().split()
13 words_less_than_40 = list(filter(lambda word: len(word) < 4, words))
14
15 for word in words_less_than_40:
16 print(word)
17
18 return (
19 "The total number of the word's count which has less than 4 characters",
20 (len(words_less_than_40)),
21 )
22
23 except FileNotFoundError:
24 print("File not found")
25
26
27print("Just need to pass the path of your file..")

Callers 1

question 2.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected