Answer:
def printWordsLines(filename):
file = open(filename, 'r')
lines = 0
words = 0
for line in file:
line.rstrip()
lines += 1
word = line.split(' ')
words += len(word)
print('the file ',filename,' contains ',words,' and ', lines, ' lines')
file.close()
printWordsLines('words')
Step-by-step explanation:
the file used was words in txt format and its contents are given as follows
hello aamir jan khan
parallelogram abdullah
anaconda ali
pycharm notebook