1. Complete read_date(): • Read an input string representing a date in the format yyyy-mm-dd. • Create a date object from the input string. o Retun the date object. 2. Call read_date) to read four (unique) date objects and store the date objects in a list. 3. Call sorted() to sort the list of date objects, earliest first. Store the sorted dates in a new list. 4. Output the sorted_dates, in the format mm/dd/yy. • Hint: Use strftime) to format the date outputs. (See resource below.) 5. Output the number of days between the last two dates in the sorted list as a positive number. 6. Output the date that is 3 weeks from the most recent date in the format "July 4, 1776'. o 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=B, weeks=2) will define a duration of 50 days + 27 seconds +8 hours + 2 weeks. 7. Output the full name of the day of the week of the earliest day.
1. Complete read_date(): • Read an input string representing a date in the format yyyy-mm-dd. • Create a date object from the input string. o Retun the date object. 2. Call read_date) to read four (unique) date objects and store the date objects in a list. 3. Call sorted() to sort the list of date objects, earliest first. Store the sorted dates in a new list. 4. Output the sorted_dates, in the format mm/dd/yy. • Hint: Use strftime) to format the date outputs. (See resource below.) 5. Output the number of days between the last two dates in the sorted list as a positive number. 6. Output the date that is 3 weeks from the most recent date in the format "July 4, 1776'. o 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=B, weeks=2) will define a duration of 50 days + 27 seconds +8 hours + 2 weeks. 7. Output the full name of the day of the week of the earliest day.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
![Complete the code to implement the following operations:
1. Complete read_date():
• Read an input string representing a date in the format yyyy-mm-dd.
o Create a date object from the input string.
• Return the date object.
2. Call read_date() to read four (unique) date objects and store the date objects in a list.
3. Call sorted() to sort the list of date objects, earliest first. Store the sorted dates in a new list.
4. Output the sorted_dates, in the format mm/dd/yy.
• Hint: Use strftime() to format the date outputs. (See resource below.)
5. Output the number of days between the last two dates in the sorted list as a positive number.
6. 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=B, weeks=2) will define a duration of 50 days + 27 seconds + 8
+2
<s.
7. Output the full name of the day of the week of the earliest day.
Ex: If the input is:
2022-01-27
2022-07-04
2020-12-31
2022-07-29
the output is:
12/31/2020
01/27/2022
07/04/2022
07/29/2022
25
August 19, 2022
Thursday](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47bcd2e2-fd09-4d16-8209-9beee0b05010%2F829d849c-8692-42dd-a41d-42fe47eadfc5%2Fo82fdi_processed.png&w=3840&q=75)
Transcribed Image Text:Complete the code to implement the following operations:
1. Complete read_date():
• Read an input string representing a date in the format yyyy-mm-dd.
o Create a date object from the input string.
• Return the date object.
2. Call read_date() to read four (unique) date objects and store the date objects in a list.
3. Call sorted() to sort the list of date objects, earliest first. Store the sorted dates in a new list.
4. Output the sorted_dates, in the format mm/dd/yy.
• Hint: Use strftime() to format the date outputs. (See resource below.)
5. Output the number of days between the last two dates in the sorted list as a positive number.
6. 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=B, weeks=2) will define a duration of 50 days + 27 seconds + 8
+2
<s.
7. Output the full name of the day of the week of the earliest day.
Ex: If the input is:
2022-01-27
2022-07-04
2020-12-31
2022-07-29
the output is:
12/31/2020
01/27/2022
07/04/2022
07/29/2022
25
August 19, 2022
Thursday
![main.py
Load default template.
1 from datetime import date, timedelta, time
2
3 # 1 Complete read_date()
4 def read_date():
"""'Read a string representing a date in the format 2121-04-12, create a
date object from the input string, and return the date object
II IIII
9 # 2. Use read_date() to read four (unique) date objects, putting the date objects in a list
10
11 # 3. Use sorted() to sort the dotes, earliest first
12
13 # 4. Output the sorted_dates in order, earliest first, in the format mn/dd/yy
14
15 # 5. Output the number of days between the last two dates in the sorted list
16 #
as a positive number
17
18 # 6. Output the date that is 3 weeks from the most recent date in the list
19
20 # 7. Output the full name of the day of the week of the earliest day
21](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47bcd2e2-fd09-4d16-8209-9beee0b05010%2F829d849c-8692-42dd-a41d-42fe47eadfc5%2Fya0shhj_processed.png&w=3840&q=75)
Transcribed Image Text:main.py
Load default template.
1 from datetime import date, timedelta, time
2
3 # 1 Complete read_date()
4 def read_date():
"""'Read a string representing a date in the format 2121-04-12, create a
date object from the input string, and return the date object
II IIII
9 # 2. Use read_date() to read four (unique) date objects, putting the date objects in a list
10
11 # 3. Use sorted() to sort the dotes, earliest first
12
13 # 4. Output the sorted_dates in order, earliest first, in the format mn/dd/yy
14
15 # 5. Output the number of days between the last two dates in the sorted list
16 #
as a positive number
17
18 # 6. Output the date that is 3 weeks from the most recent date in the list
19
20 # 7. Output the full name of the day of the week of the earliest day
21
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY