Question: 8.4 Amend the function number_of_lines() so that it reads the contents of the file stored at counts the number of lines in the file. It

8.4 8.4 Amend the function number_of_lines() so that it reads the contents of

Amend the function number_of_lines() so that it reads the contents of the file stored at counts the number of lines in the file. It should then return this number. Copy and paste the following into main.py to get started. def number_of_lines(filename): "" " Write your code here ""\|" pass def main(): print(number_of_lines( "example.txt")) \# prints 3 as example.txt contains 3 lines print(number_of_lines( "test.txt")) \# prints 25 as test.txt contains 25 lines if _name__== "_main_-": main()

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!