Question: I need a python 3 help Question 2: Putting it all together. For this problem, you are going to be working with real data taken

I need a python 3 help

Question 2: Putting it all together.

For this problem, you are going to be working with real data taken from the UCSD library system. You must Regex in this question in order to get credit.

1. Create a pattern to find all books that have a year of N. Note that years are displayed as either N or cN. If a book has both, count them as one occurrence of a book.

def year_match(string, year): """Returns whether a string matches a specific year :param string: a nonempty string :param year: a positive integer :returns: a nonnegative integer

>>> file = open("data.txt", "r") >>> count = 0 >>> for line in file: ... if year_match(line,2002): ... count = count +1 ... >>> count 12 """

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!