Question: I'm using python. Part I: Date Reformatter (4 points) Write a function reformat date() that takes a string argument containing a date in one format
I'm using python. Part I: Date Reformatter (4 points) Write a function reformat date() that takes a string argument containing a date in one format it and returns the date in another format. Specifically, it converts an argument like 10/31/2017 (MM/DD/YYYY) to 31-OCT-17 (DD-MMM-YY). The three-letter abbreviations in the return value must be given in all capital letters: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. (Hint: you dont need 12 if-statements to map month numbers to these strings. Try to think of another way...) The returned day and year must be given as two-digit values, even if the first digit is a 0. The argument will not include leading zeroes. You may assume that the year is in the range 2000-2999, inclusive. Examples: Function Call Return Value reformat date(5/17/2021) 17-MAY-21 reformat date(12/31/2000) 31-DEC-00 reformat date(9/8/2017) 08-SEP-17 reformat date(8/5/2003) 05-AUG-03 Note that the quotation marks displayed in the examples are there to emphasize that the argument and return value are strings. You should not add quotation marks to your return values. def reformat_date(date):
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
