Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago