Introduction In this lab, you are writing a function slashes_to_written(date_list) that gets the list in the [MM, DD, YYYY] format and displays it in a written format. Note: we are using the US format for strings: //. For example, 01/02/2022 can be represented as ['01', '02', '2022'] represents January 2nd, 2022. Written Format slashes_to_written(["01", "01", "1970"]) must return "January 1, 1970" slashes_to_written(["02", "03", "2000"]) must return "February 3, 2000" slashes_to_written(["10", "15", "2022"]) must return "October 15, 2022" slashes_to_written(["12", "31", "2021"]) must return "December 31, 2021" Instructions Finish the slashes_to_written() function 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 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 output. You do not need to check if the date in the date_list passed in is valid or not. You can assume it is valid. (In the real-life scenario you would, of course, call validate_date() to make sure it is valid, and only then call slashes_to_written(). You can assume that at this point the input is valid. ) Troubleshooting If you are getting a KeyError: '01' for "01" pay attention to what is the type of the keys stored 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. ;-)
Introduction In this lab, you are writing a function slashes_to_written(date_list) that gets the list in the [MM, DD, YYYY] format and displays it in a written format. Note: we are using the US format for strings: //. For example, 01/02/2022 can be represented as ['01', '02', '2022'] represents January 2nd, 2022. Written Format slashes_to_written(["01", "01", "1970"]) must return "January 1, 1970" slashes_to_written(["02", "03", "2000"]) must return "February 3, 2000" slashes_to_written(["10", "15", "2022"]) must return "October 15, 2022" slashes_to_written(["12", "31", "2021"]) must return "December 31, 2021" Instructions Finish the slashes_to_written() function 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 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 output. You do not need to check if the date in the date_list passed in is valid or not. You can assume it is valid. (In the real-life scenario you would, of course, call validate_date() to make sure it is valid, and only then call slashes_to_written(). You can assume that at this point the input is valid. ) Troubleshooting If you are getting a KeyError: '01' for "01" pay attention to what is the type of the keys stored 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. ;-)
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
Related questions
Question
100%
Introduction
In this lab, you are writing a function slashes_to_written(date_list) that gets the list in the [MM, DD, YYYY] format and displays it in a written format.
Note: we are using the US format for strings: <MM>/<DD>/<YEAR>. For example, 01/02/2022 can be represented as ['01', '02', '2022'] represents January 2nd, 2022.
Written Format
- slashes_to_written(["01", "01", "1970"]) must return "January 1, 1970"
- slashes_to_written(["02", "03", "2000"]) must return "February 3, 2000"
- slashes_to_written(["10", "15", "2022"]) must return "October 15, 2022"
- slashes_to_written(["12", "31", "2021"]) must return "December 31, 2021"
Instructions
- Finish the slashes_to_written() function
- 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 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 output.
- You do not need to check if the date in the date_list passed in is valid or not. You can assume it is valid. (In the real-life scenario you would, of course, call validate_date() to make sure it is valid, and only then call slashes_to_written(). You can assume that at this point the input is valid. )
Troubleshooting
- If you are getting a KeyError: '01' for "01" pay attention to what is the type of the keys stored 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. ;-)
Expert Solution
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 5 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education