Question: I have my program down below and i need it to run the text file out like how it shows below with all of the

I have my program down below and i need it to run the text file out like how it shows below with all of the dates please.

Create a main function that:

o

Reads the information from the text file into a list of strings

o

Iterates through the list, one string at a time

Calls the isValid year function

Only calls the isValidMonth function if the year was valid

Only calls the isValidDay function if the year and month were valid

Stores the string and the result in another list

o

Prints the report

I have my program down below and i need it to runthe text file out like how it shows below with all ofthe dates please. Create a main function that: o Reads the information

Reads date information from a text file o Be sure to ask the user to enter the file name and end the program if the file doesn't exist. o Text file format will be similar to the information shown below: 12-31-2020 12-32-2020 1a-30-2020 12-20-2020 12-30-99999 12-30--209 2-29-2020 2-29-2021 Read the data into a list o Process each entry, and determine if the date is valid or not. Print a report that shows the following: Entry Valid/Invalid Reason 12-31-2020 12-32-2020 1a-30-2020 12-?0-2020 Valid Invalid Invalid Invalid N/A Invalid Day Invalid Month Invalid Day import datetime from calendar import * def isValidMonth (tmpMonth): if not tmpMonth.isdigit(): return false if int (tmpMonth) 12: return false return True def isValidYear (year): if not year.isdigit(): return false if (int (year) datetime .MAXYEAR) : return false return True def isValidDay(stringDay, intergerMonth, intergerYear): if not stringDay.isdigit(): return false try: datetime.datetime (int (intergerYear), int (intergerMonth), int (stringDay)) return True except ValueError: return false import modverifyDates from os. path import * def readData(): lineList = [] fileName input ("Enter Filename:") if isfile (fileName) : fobj = read (fileName, "r") tmpStr = fobj.read() lineList = tmpStr.split(' ') return linelist else: return [] def main(): lineList = readData() if len (lineList) != 0: return True else: print ("No Such File")|

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!