Question: Python Programming - I've created code for the program but it needs correction. The function should accept time and date strings from the user in

Python Programming -

I've created code for the program but it needs correction. The function should accept time and date strings from the user in the console. For example, Ask user to enter time and date. Make sure my code follows the above criteria and correct it when it doesn't . Provide properly formatted code. Thanks

Python Programming - I've created code for the program but it needs

My code:

def is_leapday(s): """Decides if a date/time like 'Mar 23, 2002 4:12:55am' is during a leap day Returns None when the date is invalid, True when it is a leap day, False otherwise""" #month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] format = bool(re.match(r'^\w{3}\s\d{1,2},\s\d{4}\s\d{1,2}:\d{2}:\d{2}\w{2}$' , s)) if format == True: leapday = re.findall(r'\w{3}\s\d{2}', s) j = " " if j.join(leapday) == "Feb 29": print(s + " is during a leap day.") return True else: print(s + " is not during a leap day.") return False pass

1b) is leapday: This function should accept time-and-date strings formatted like"May 8, 2009 1:09:59am" and return None if the date+time is invalid (that date and time did not exist or is not written in the proper format), False-as in this example-if the time does not fall on a leap day, or True if it does fall on a leap day-as in "Feb 29, 2000 12:00:00pm. The month codes are Jan, Feb, Mar, Apr, May, Jun, JulAug, Sep, Oct, Nov, Dec

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!