Question: Complete the code to implement the following operations: Complete read _ date ( ) : Read an input string representing a date in the format

Complete the code to implement the following operations:
Complete read_date():
Read an input string representing a date in the format yyyy-mm-dd.Create a date object from the input string.Return the date object.
Call read_date() four times to read four (unique) date objects and store the date objects in a list.
Call sorted() to sort the list of date objects, earliest first. Store the sorted dates in a new list.
Output the sorted_dates, in the format mm/dd/yyyy.
Hint: Use strftime() to format the date outputs. (See resource below.)
Output the number of days between the last two dates in the sorted list as a positive number.
Output the date that is 3 weeks from the most recent date in the format "July 4,1776".
Hint: Use timedelta() to set a duration of time for the arithmetic on date objects. (See resources below.)
Ex: timedelta(days=50, seconds=27, hours=8, weeks=2) will define a duration of 50 days +27 seconds +8 hours +2 weeks.
Output the full name of the day of the week of the earliest day

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 Programming Questions!