Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started