Introduction In this lab, you are writing a function get_written_date(date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns the resulting date (in the US format) as a string. Note: we are using the US format for strings: //. For example, 01/02/2022 can be represented as ['01', '02', *2022'], which represents January 2nd, 2022. Test Your Code assert get_written_date(["01", "01", "1970"]) == "January 1, 1970" assert get_written_date(["02", "03", "2000"]) == "February 3, 2000" assert get_written_date(["10", "15", "2022"]) == "October 15, 2022" assert get_written_date(["12", "31", "2021"]) == "December 31, 2021" Instructions Use the dictionary month_names that maps months to their English names. month_names = { 1: "January", 2: "February", 3: "March" } Note: the month key in the dictionary is stored as an integer, however, in the input list it is stored as a string in the MM format, e.g., "01". Also, pay attention how the day is represented in the list and how it is supposed to be output. • You may assume that the dates in date_list is a valid date. Troubleshooting If you are getting a KeyError: '01' for "01" pay attention to the type of the keys in the dictionary. (See the Note above :-)) If you are having trouble converting a "01" into just 1, think how you would turn just "1" into an integer. ;-) What if you use the same mechanism with "01"?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please Use Python

def get_written_date(date_list):
    """
    The function ...
    """
    month_names = {
        1: "January",
        2: "February",
        3: "March",
        4: "April",
        5: "May",
        6: "June",
        7: "July",
        8: "August",
        9: "September",
        10: "October",
        11: "November",
        12: "December",
    }
    # Finish the function
    
    # Return the date string in written format
    
    

if __name__ == "__main__":
    assert get_written_date(["01", "02", "2022"]) == 'January 2, 2022'
    assert get_written_date(["01", "12", "1970"]) == 'January 12, 1970'
    assert get_written_date(["04", "14", "2020"]) == 'April 14, 2020'
    assert get_written_date(["06", "19", "2000"]) == 'June 19, 2000'

Introduction
In this lab, you are writing a function get_written_date(date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY]
format and returns the resulting date (in the US format) as a string.
Note: we are using the US format for strings: <MM>/<DD>/<YEAR>. For example, 01/02/2022 can be represented as ['01', '02',
*2022' ], which represents January 2nd, 2022.
Test Your Code
assert get_written_date(["02",
assert get_written_date(["01", "01", "1970"]) == "January 1, 1970"
"03", "2000"]) == "February 3, 2000"
assert get_written_date(["10", "15", "2022"]) "October 15, 2022"
assert get_written_date(["12", "31", "2021"]) == "December 31, 2021"
Instructions
Use the dictionary month_names that maps months to their English names.
month_names = {
1: "January",
2: "February",
3: "March"
...
==
Note: the month key in the dictionary is stored as an integer, however, in the input list it is stored as a string in the MM format, e.g., "01".
Also, pay attention how the day is represented in the list and how it is supposed to be output.
You may assume that the dates in date_list is a valid date.
Troubleshooting
If you are getting a KeyError: '01' for "01" pay attention to the type of the keys in the dictionary. (See the Note above :-))
If you are having trouble converting a "01" into just 1, think how you would turn just "1" into an integer. ;-) What if you use the same
mechanism with "01"?
Transcribed Image Text:Introduction In this lab, you are writing a function get_written_date(date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns the resulting date (in the US format) as a string. Note: we are using the US format for strings: <MM>/<DD>/<YEAR>. For example, 01/02/2022 can be represented as ['01', '02', *2022' ], which represents January 2nd, 2022. Test Your Code assert get_written_date(["02", assert get_written_date(["01", "01", "1970"]) == "January 1, 1970" "03", "2000"]) == "February 3, 2000" assert get_written_date(["10", "15", "2022"]) "October 15, 2022" assert get_written_date(["12", "31", "2021"]) == "December 31, 2021" Instructions Use the dictionary month_names that maps months to their English names. month_names = { 1: "January", 2: "February", 3: "March" ... == Note: the month key in the dictionary is stored as an integer, however, in the input list it is stored as a string in the MM format, e.g., "01". Also, pay attention how the day is represented in the list and how it is supposed to be output. You may assume that the dates in date_list is a valid date. Troubleshooting If you are getting a KeyError: '01' for "01" pay attention to the type of the keys in the dictionary. (See the Note above :-)) If you are having trouble converting a "01" into just 1, think how you would turn just "1" into an integer. ;-) What if you use the same mechanism with "01"?
LAB
ACTIVITY
1 def get_written_date(date_list):
2
The function ...
3
4
5
6.700 a
8
9
10
11
12
13
14
45600
7.18.1: LAB: Project Component - Date Conversion
15
16
17
18
month names = {
1: "January",
2: "February"
}
3: "March",
4: "April",
5: "May",
6: "June"
7: "July",
8: "August",
9: "September",
10: "October",
11: "November",
12: "December".
main.py
0/11
Load default template...
Transcribed Image Text:LAB ACTIVITY 1 def get_written_date(date_list): 2 The function ... 3 4 5 6.700 a 8 9 10 11 12 13 14 45600 7.18.1: LAB: Project Component - Date Conversion 15 16 17 18 month names = { 1: "January", 2: "February" } 3: "March", 4: "April", 5: "May", 6: "June" 7: "July", 8: "August", 9: "September", 10: "October", 11: "November", 12: "December". main.py 0/11 Load default template...
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education