Question: Python homework 5. Write a function counter that reads data from a file and return a count of how many values in the file are

 Python homework 5. Write a function counter that reads data from
Python homework

5. Write a function counter that reads data from a file and return a count of how many values in the file are equal to the second parameter. Each value is on its own line in the file and you can assume it's an integer. You must catch errors that occur when working with the file. >>> counter ('numbers.txt',30) 2 >>> counter ('numbers.txt',99) 1 >>> counter('numbers2.txt',77) 2 >>> counter ('numbers2.txt', 60) 2 >>> counter ('numbers2.txt',55) 0

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!