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
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
Get step-by-step solutions from verified subject matter experts
