Menu

Strings Function Name Datecruncher Parameters Original Dates List Strings Return Type List Q43855106

Strings Function name: date_cruncher Parameters: original dates (list of strings) Return Type: list Description: Write a funcStrings Function name: date_cruncher Parameters: original dates (list of strings) Return Type: list Description: Write a function that takes in a list of dates in “{month name} {date}, {year}” format, formats them into “{MM}-{DD-YYYY}” format, and returns the list of formatted dates. In original dates, the month could be the full month name OR a three-letter abbreviation of the month name (e.g., “October” vs. “Oct”). You should account for the month name having any type of capitalization. The date could be just a number (e.g., “18”, “30”) or the ordinal number (e.g., “1st”, “2nd”, “3rd”, “4th”, etc.). You can assume the year will be 4 digits long. The formatted dates in the list returned should have the month and date both appear as two-digit integers. Test Cases: >>> original_dates = [“March 2nd, 2019”, “July 8th, 1997”, “September 19th, 4001”, “January 1st, 0001”] >>> date_cruncher (original_dates) [’03-02-2019′, ’07-08-1997′, ’09-19-4001′, ’01-01-0001′] >>> original_dates – [“dEcEmBER 3, 2020”, “FEB 31st, 6000”, “apr 5, 1776”] >>> date_cruncher (original_dates) [’12-03-2020′, ’02-31-6000′, ’04-05-1776′) Testing Your Code Show transcribed image text Strings Function name: date_cruncher Parameters: original dates (list of strings) Return Type: list Description: Write a function that takes in a list of dates in “{month name} {date}, {year}” format, formats them into “{MM}-{DD-YYYY}” format, and returns the list of formatted dates. In original dates, the month could be the full month name OR a three-letter abbreviation of the month name (e.g., “October” vs. “Oct”). You should account for the month name having any type of capitalization. The date could be just a number (e.g., “18”, “30”) or the ordinal number (e.g., “1st”, “2nd”, “3rd”, “4th”, etc.). You can assume the year will be 4 digits long. The formatted dates in the list returned should have the month and date both appear as two-digit integers. Test Cases: >>> original_dates = [“March 2nd, 2019”, “July 8th, 1997”, “September 19th, 4001”, “January 1st, 0001”] >>> date_cruncher (original_dates) [’03-02-2019′, ’07-08-1997′, ’09-19-4001′, ’01-01-0001′] >>> original_dates – [“dEcEmBER 3, 2020”, “FEB 31st, 6000”, “apr 5, 1776”] >>> date_cruncher (original_dates) [’12-03-2020′, ’02-31-6000′, ’04-05-1776′) Testing Your Code

Expert Answer


Answer to Strings Function name: date_cruncher Parameters: original dates (list of strings) Return Type: list Description: Write a…

OR