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. ;-)

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18SA
icon
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. ;-)

 

 

 

 

 

378010.2361630.qx3zqy7
LAB
7.18.1: Week 7 Project Component Lab - Create a Task
0/7
АCTIVITY
main.py
Load default template..
1 def create_task(keys, vals):
II II ||
2
The function takes a list with the keys and a list
with the corresponding values and returns a dictionary
with the provided keys mapping to the corresponding values.
"""|
3
4
5
7
pass
8
9 if -_name__
"__main__":
10
task_fields
["name", "description", "due date", "priority"]
11
12
for field in task_fields:
print(f"Enter the task {field}:")
value
13
14
input()
15
print("FIXME: finish the program")
Run your program as often as you'd like, before submitting for grading. Below, type any needed
input values in the first box, then click Run program and observe the program's output in the
Develop mode
Submit mode
second box.
Transcribed Image Text:378010.2361630.qx3zqy7 LAB 7.18.1: Week 7 Project Component Lab - Create a Task 0/7 АCTIVITY main.py Load default template.. 1 def create_task(keys, vals): II II || 2 The function takes a list with the keys and a list with the corresponding values and returns a dictionary with the provided keys mapping to the corresponding values. """| 3 4 5 7 pass 8 9 if -_name__ "__main__": 10 task_fields ["name", "description", "due date", "priority"] 11 12 for field in task_fields: print(f"Enter the task {field}:") value 13 14 input() 15 print("FIXME: finish the program") Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the Develop mode Submit mode second box.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Linked List Representation
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning