Python 2
Python 2
This program opens the file in read mode, reads all lines, and uses len() to count the total
number of lines.
This program reads each line, splits it into individual words using split(), and counts the
total words by summing up the length of each line's word list.