# 9th Homework

This homework has to be prepared in teams. Find your partners on https://discordapp.com/. Download hw_9.tar.gz and extract it. Then add your homework solutions to the directory. Rename the directory according to the rules in the syllabus before submitting it as compressed archive. Don't forget to add the correct subject to the email when submitting.

All of the tasks below need to

• run with the provided input data without crashing
• produce correct results
• have a comprehensive amount of unit tests
• have proper docstrings
• be implemented without using non-English function and variable names, docstrings etc.

in order to receive (full) points.

You'll have to start by implementing a decent test-suite for each of the tasks. Only when you're done with your tests, implement the task itself. The grader will mainly use your own tests to determine your score. If the test-suite is comprehensive, the grader's score will be awarded fully. Otherwise, reasonable deductions will be made.

In this homework, it is up to you to pick one of the tasks below and solve it.

• Doubly linked list (9 points)
You are employed to help a company with the following task: they use an already existing program in the file shift_planner.py. Since the last update, their program requires a high-level data structure named DoublyLinkedList. This data structure can be used as the widely used abstract data structures queue or stack. Your task is to implement a DoublyLinkedList such that their program can be run without changes.
It must offer the following public API:
• first - @property that returns the first element.
• last - @property that returns the last element.
• push_back(.) - Adds an element at the end of the doubly linked list.
• pop_back() - Removes an element from the end of the doubly linked list and returns it.
• push_front(.) - Adds an element at the beginning of the doubly linked list.
• pop_front() - Removes an element from the beginning of the doubly linked list and returns it.
• elements() - Generator method (using the command yield)
Note that the data structure should be as stable as possible and raise a RuntimeError if a pop method is used on an empty list. Also do not forget to implement the __str__(self) method!
Properly test your data structure and all the operations it supports.