Question: PYTHON . Develop a program to maintain a list of homework assignments. When an assignment is assigned, add it to the list with a due
- PYTHON. Develop a program to maintain a list of homework assignments. When an assignment is assigned, add it to the list with a due date, and when it is completed, remove it. No global variables are used in the function. Function parameters must be used.
Your program should provide the following functions:
- Add a new assignment.
- Remove an assignment.
- Provide a list of the assignments in the order they were assigned. The output should display each assignment line by line.
- Provide a list of the assignments in the order they are due. The output should display each assignment line by line.
Use the following starter code to help. Read the comments carefully.
| def add_assignment(assignment_list, assignment): # add assignment to assignment_list def remove_assignment(assignment_list, assignment): # remove an assignment from the assignment_list # if the assignment exists in the assignment_list def display_assignments(assignment_list): print("Assignments in the order they were assigned") # print each assignment line by line def display_assignments_by_due_date(assignment_list): print("Assignments in the order they are due") # print each assignment line by line # create an empty list to hold the assignments my_assignments = [ ] # create an assignment. # Put date in first field with YYYY/MM/DD format assignment1 = ["2018/10/07", "MATH101"] # create more assignments # call add_assignment function to add assignment add_assignment(my_assignments, assignment1) # call add_assignment to add more assignments to the assignment_list # display the assignments by order they are entered # and by the order they are due. # call remove_assignment to remove one assignment # display the assignments by order they are entered and # by order they are due. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
