Question: PROBLEM 8 Frequently data contains mixed formats for dates and times. Here you will create a program to handle mixed formats for dats. Write a

 PROBLEM 8 Frequently data contains mixed formats for dates and times.
Here you will create a program to handle mixed formats for dats.

PROBLEM 8 Frequently data contains mixed formats for dates and times. Here you will create a program to handle mixed formats for dats. Write a function that takes a list of two dates in format of MM-DD-YYYY or MMDDYYYY as input and returns a list containing the number of years, months, weeks and days between the two as outputs. The two dates will be formatted as a list. Using two functions will help with the two formats. This code should handle invalid dates by printing 'ERROR, invalid date.' It is recommended that you use the datetime package from Python. NOTE: for the purpose of this exercise you may consider months equal to 30.5 days, or you may consider the value specific to each month. NOTE: full credit will be awarded If the years, months and weeks are correct. In 1211 import datetime Valid dates: In 1 1 datel - 10-03-1983.-01-19451 dates - 1161949.'08.04.2012'1 dates - 02-25-2000, 12-11-2017 dates - 02-01-1996.11242456) dateas - 1'07-05-3060, 070420601 Invalid dates: int in date-110321610-30-1967 dated - 100-17-1916-05-1976) date-10-30-1997 05-01-2018 1 1 datorat (d) TOUR CORROW YOUR OUTPUT: In Cottate datel) in corbates date) In convertDate(data In 1: colates dates) ICON Dedate) 1. CVbates dates In 1: contatto In 1: convertDates dates CORRECT OUTPUT: In 1941: DVDatadatel 13, 3.0.021 Is 1251 portate date 167, 10, 1.0, T 11 sentedate) 117., 1.0, 61 in verbotsdaten) 1460. 1, 2.0.6 In 1251 datust 10.0.0.0, 11 O, invalid date 151 Verbatas data) Lwvalid date. Invertoate date Functions & Mo...ipynb PROBLEM 8 Frequently data contains mixed formats for dates and times. Here you will create a program to handle mixed formats for dats. Write a function that takes a list of two dates in format of MM-DD-YYYY or MMDDYYYY as input and returns a list containing the number of years, months, weeks and days between the two as outputs. The two dates will be formatted as a list. Using two functions will help with the two formats. This code should handle invalid dates by printing 'ERROR, invalid date.' It is recommended that you use the datetime package from Python. NOTE: for the purpose of this exercise you may consider months equal to 30.5 days, or you may consider the value specific to each month. NOTE: full credit will be awarded If the years, months and weeks are correct. In 1211 import datetime Valid dates: In 1 1 datel - 10-03-1983.-01-19451 dates - 1161949.'08.04.2012'1 dates - 02-25-2000, 12-11-2017 dates - 02-01-1996.11242456) dateas - 1'07-05-3060, 070420601 Invalid dates: int in date-110321610-30-1967 dated - 100-17-1916-05-1976) date-10-30-1997 05-01-2018 1 1 datorat (d) TOUR CORROW YOUR OUTPUT: In Cottate datel) in corbates date) In convertDate(data In 1: colates dates) ICON Dedate) 1. CVbates dates In 1: contatto In 1: convertDates dates CORRECT OUTPUT: In 1941: DVDatadatel 13, 3.0.021 Is 1251 portate date 167, 10, 1.0, T 11 sentedate) 117., 1.0, 61 in verbotsdaten) 1460. 1, 2.0.6 In 1251 datust 10.0.0.0, 11 O, invalid date 151 Verbatas data) Lwvalid date. Invertoate date Functions & Mo...ipynb

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!