diff --git a/unika/unika.py b/unika/unika.py new file mode 100644 index 000000000..d9f23624b --- /dev/null +++ b/unika/unika.py @@ -0,0 +1,29 @@ +# A simple Python program for implementing linked list in python +# Node class +class Node: + # Function to initialise the node object + def __init__(self, data): + self.data = data # Assign data + self.next = None +class LinkedList: + def __init__(self): + self.head = None + # This function prints contents of linked list + # starting from head + def printList(self): + temp = self.head + while (temp): + print temp.data, + temp = temp.next +# Code execution starts here +if __name__=='__main__': + # Start with the empty list + llist = LinkedList() + llist.head = Node(1) + second = Node(2) + third = Node(3) + + llist.head.next = second; # Link first node with second + second.next = third; # Link second node with the third node + + llist.printList()