Question: Use the code template below as a starting from __future__ import annotations from typing import Any, Optional class Node: def __init__(self, value: Any, nxt: LinkedList):

 Use the code template below as a starting from __future__ import

Use the code template below as a starting

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_- function in your Node class. This will help with testing

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!