Question: hey, I need help with this question It is in python. the linkedlist class is down below just need to add this function to it
hey, I need help with this question It is in python. the linkedlist class is down below just need to add this function to it


The diagram below displays a linked list named "fruit". Notice that the head instance variable refers to the first node in the linked list. object head fruit 'apple 'banana' 'cherry Add the has_same_elements(self, list2) method to the Linkedlist class above. This method takes a LinkedList object as a parameter and returns True if the linked list and the parameter linked list contain exactly the same elements in any order and have exactly the same number of elements. In all other cases the function returns False. Notes: You may assume that the Node class is defined for you. Do not define a new Node class. Submit your entire Linkedlist class definition in the answer box below. For example: Test Result False a_list1 = LinkedList() a_list2 = LinkedList() for element in [3, 13, 6, 1, 8, 9]: a_list1.add(element) for element in (1,3, 6, 9, 8]: a_list2.add(element) print(a_list1. has_same_elements(a_list2)) True a_list1 = LinkedList() a_list2 = LinkedList() print(a_list1.has_same_elements(a_list2)) Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) AWNE = 1 class LinkedList: 2 def __init__(self): 3 self.__head None 4, def add(self, item): #add to the beginning of the list 5 new_node = Node(item, self.__head) 6 self.__head new_node 7 def size(self): 8 current self.__head 9 count = 0 10 while current != None: 11 count count + 1 12 current current.get_next() 13 return count 14 def is_empty(self): 15 return self.__head None 16 def -_str__(self): 17 result "[" 18 separator 19 current self.__head 20 while current != None: result += separator + str(current.get_data()) 22 separator current = current.get_next() 24 result += "]" 25 return result 26 21 11 23