myLinkedList

Run Settings
LanguagePython
Language Version
Run Command
# creating linked list in python # 10->3->5 # linked_list = { # "head":{ # "value": 10, # "next":{ # "value":3, # "next":{ # "value":5, # "next":None, # } # } # } # } # print(linked_list["head"]["next"]["next"]["value"]) # ll by oop class LinkedList: def __init__(self, value1, value2, value3): self.head ={ "value": value1, "next": { "value": value2, "next":{ "value":value3, "next": None } } } # method to append item at none def append(self, item): self.head["next"]["next"]["next"] = { "value": item, "next":None } def preppend(self, value0): self.hero={ "value":value0, "next": self.head } myLinkedList = LinkedList(12,3,5) print(myLinkedList.head["next"]["next"]["value"]) myLinkedList.append(88) print(myLinkedList.head["next"]["next"]["next"]["value"]) myLinkedList.preppend(24) print(myLinkedList.hero["next"]["value"])
Editor Settings
Theme
Key bindings
Full width
Lines