Answered step by step
Verified Expert Solution
Question
1 Approved Answer
question : complete an UnorderedList class using the node class below. append: adds data to the list __len__ : returns the length of the list
question : complete an UnorderedList class using the node class below.
append: adds data to the list
__len__ : returns the length of the list
__getitem__ : returns the data of the index given
__setitem__ : changes (or sets) the data at the index given
__str__ : returns the list as a string
class Node: def init-data): _init-(self, self.data - init data self, next = None def get_data(self): def get_next(self): def set_data(self, new_data): def set_next (self, new next): return self.data return self.next self.data = new data self.next new next class UnorderedList: def init(self): self.head -None def is_empty(self): return sel f . head : None def append (self, item): # Code Here def-len-(self): # Code Here def getitem (self,key): def setitem (self,key, item): def-str-(self): # Code Here # Code Here # Code HereStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started