import LinkedList # Create a linked list my_list = LinkedList() # Append elements to the end of the list my_list.append(1) my_list.append(2) my_list.append(3) # Print the list print(my_list)
1 -> 2 -> 3
import LinkedList # Create two linked lists list1 = LinkedList() list2 = LinkedList() # Append elements to the first list list1.append(1) list1.append(2) # Append elements to the second list list2.append(3) list2.append(4) # Append list2 to list1 list1.append(list2) # Print the list print(list1)
1 -> 2 -> 3 -> 4The LinkedList package library used in these examples may vary depending on the implementation used. Some popular libraries include the built-in `collections` module, `linkedlist` library from the `Python Mini Projects` package, and `pyllist` library.