Computer Science, asked by jcksnsoul59, 1 month ago


3. Write a function count(mm ) to read a text file represented by the parameter and counts the no. of occurrences of the words “He” and “Him” in it.

Answers

Answered by goldenwind
0

def count(mm: str):

file = open(mm)

content = file.readlines()

counter = 0

for "he" or "him" in content:

counter = counter + 1

return counter

usage:

count('paragraph.txt')

Similar questions