Question: from __future__ import annotations from typing import Any, Optional class Node: def __init__(self, value: Any, nxt: LinkedList): self.value = value self.next = nxt LinkedList =

from __future__ import annotations
from typing import Any, Optional
class Node: def __init__(self, value: Any, nxt: LinkedList): self.value = value self.next = nxt
LinkedList = Optional[Node]
def empty_list() -> LinkedList: ...
def add(lst: LinkedList, index: int, value: Any) -> LinkedList: ...
def length(lst: LinkedList) -> int: ...
def get(lst: LinkedList, index: int) -> Any: ...
def setitem(lst: LinkedList, index: int, value: Any) -> LinkedList: ...
def remove(lst: LinkedList, index: int) -> tuple[Any, LinkedList]: ...
In a file named linked_list.py, provide a data definition for a LinkedList, whose Node class's value field can be any value. An empty list should be represented by the Python value None. Be sure to call your node class Node, so that my tests can create objects correctly. Implement the functions listed above. None of the functions should modify the list that you're given. All of the functions should return a new list. Additionally, implement the __eq equanction in your Node class. This will help with testing. Place your test cases in a file named linked_list_tests.py. Include type signatures and a docstring purpose statement as appropriate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
