Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python coding please CSc 120: Parsing Dates Expected Behavior Write a Python function canonicalize_date(date_str) that takes a string date_str, representing a date in one of

image text in transcribed

image text in transcribed

Python coding please

CSc 120: Parsing Dates Expected Behavior Write a Python function canonicalize_date(date_str) that takes a string date_str, representing a date in one of several possible formats, and returns a string that is the canonical representation of that date. I. Input Representation of Dates The string passed to the canonicalize_date (date str) function can be in any of the following three formats. e yyyy-mm-dd, where yyyy is a 4-digit sequence giving the year; mmis a 1- or 2-digit sequence giving the month; and dd is a 1- or 2-digit sequence giving the date. Example: 2017-02-31 mm/dd/yyyy. where yyyy is a 4-digit sequence giving the year; mmis a 1- or 2-digit sequence giving the month; and dd is a 1-or 2-digit sequence giving the date Example: 02/31/2017 MonthName dd yyyy, where MonthNane is a three-letter sequence giving the name of a month (one of: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec): dd is a 1- or 2-digit sequence giving the date; and vyyy is a 4-digit sequence giving the year. Example: Feb 31 2017 NOTE: To simplify programming, we will assume that all months have 31 days Il. Canonical Representation of Dates A date with year yyy, month mm, and day dd, where yvyy, mm, and dd are strings of digits, has a canonical (e, standard) representation given by "(d)-(d)-(:d)".format( int (yyyy, int (mm), int(dd) dd to numbers using

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

8. Explain how to price managerial and professional jobs.pg 87

Answered: 1 week ago