o print a task in a human-readable format, make sure that
- The name is written in all caps (i.e., capital letters),
- The priority is converted from an integer to its corresponding string status ("Low", "Lowest", "Medium", "High", "Highest")
- The deadline is converted to its written format (see Lab 7.19)
- The completed field is converted to a "Yes" or "No".
Also, we want to print not just a single task, but a list of tasks, so we will print the index of a task on the same line as its name. We will also print a newline after printing a task to separate them in a list. Here is what the print should look like when a list with just 1 element gets printed:
my_list = [{ 'name': 'get groceries', 'description': 'buy jam and peanut butter', 'priority': 2, 'deadline': '02/23/2022', 'completed': False }] print_formatted_tasks(my_list)
The function call should print:
0: GET GROCERIES Description: buy jam and peanut butter Priority: Low Deadline: February 23, 2022 Completed: No
def print_formatted_tasks(tasks_list):
# Finish the function definition
if tasks_list[0].isdigit():
if tasks_list[1].isdigit():
if tasks_list[2].isdigit():
description =
completed = str(task_list[0])
priority = str(task_list[1])
deadline = int(print_formatted_tasks(tasks_list))
return (f'{description[]},{completed},{deadline}')
# Return the date string in written format
if __name__ == "__main__":
# for testing purposes, so you can observe the output
my_list = [{
'name': 'get groceries',
'description': 'buy some jam and peanut butter',
'deadline': '02/23/2022',
'priority': 2,
'completed': False
},
{
'name': 'get some sleep',
'description': '8 hours of sleep is necessary',
'deadline': '02/03/2022',
'priority': 3,
'completed': False
},
{
'name': 'compar. lit essay',
'description': "finish comparative lit essay that's overdue",
'deadline': '02/15/2022',
'priority': 4,
'completed': True
}]
print_formatted_tasks(my_list)