Write a function create_task that creates a dictionary to store the information for a single task. This function takes two parameters: 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. In our main program, we will create a list with the keys that allow us to capture: the name of the task (a string) description (a string) due date (a list) priority (an integer) In the main program, create a list called task_fields that stores these keys: task_fields = ["name", "description", "due date", "priority"] Do not hardcode these fields in the function -- they are provided as the argument into the function. Loop over each key to ask the user to input the corresponding information

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

Write a function create_task that creates a dictionary to store the information for a single task. This function takes two parameters: 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.

In our main program, we will create a list with the keys that allow us to capture:

  • the name of the task (a string)
  • description (a string)
  • due date (a list)
  • priority (an integer)

In the main program, create a list called task_fields that stores these keys:

task_fields = ["name", "description", "due date", "priority"]

Do not hardcode these fields in the function -- they are provided as the argument into the function.

Loop over each key to ask the user to input the corresponding information. Assemble it into a new list.

Call create_task with these two lists as an input to get the dictionary with the task information.

Print the resulting dictionary from the main program.

When running the program, you could see the following prompts with the sample user input (note that the resulting dictionary is printed by the main program, not by the function):

Enter the task name: Do homework Enter the task description: Finish reading Chapter 7 Enter the task due date: 02/18/2022 Enter the task priority: 5 {'name': 'Do homework', 'description': 'Finish reading Ch7', 'due date': '02/18/2022', 'priority': '5'}

def create_task(keys, vals):
    """
    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.
    """
    
    pass

if __name__ == "__main__":
    task_fields = ["name", "description", "due date", "priority"]
    
    for field in task_fields:
        print(f"Enter the task {field}:")
        value = input()
        print("FIXME: finish the program")

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Lists
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