Question: Write two programs in python that count the number lines in the text file dataFile.txt. In the first program use a for loop to iterate

Write two programs in python that count the number lines in the text file dataFile.txt.

In the first program use a for loop to iterate over each line in the file

In the second program use a while loop to read each line until the end of file has been reached. Youll know when the end of file has been reached because the readline( ) will return an empty string () when you try to read past the end of the file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!