Singly Linked List

#!/usr/bin/env python

class Node(object):

    def __init__(self, _value, _nextNode):
        self.value = _value
        self.next = _nextNode


class LinkedList(object):

    head = None

    def show(self):
        n = self.head
        while n is not None:
            print n.value,
            n = n.next
        print


    def push(self, _v):
        new_node = Node(_v, None)

        new_node.next = self.head
        self.head = new_node


    def append(self, _v):
        new_node = Node(_v, None)
        last_node = self.head
 
        if self.head is None:
            self.head = new_node
            return

        while last_node.next is not None:
            last_node = last_node.next
        
        last_node.next = new_node
        

    def delete(self, _v):
        node = self.head
        
        if self.head is None:
            print 'list is empty'
            return
        
        if node.value == _v:
            self.head = node.next
            return

        while node.next is not None:
            if node.next.value == _v:
                node.next = node.next.next
                return

            node = node.next

        

l = LinkedList()
l.push(10)
l.push(20)
l.push(30)
l.show()
l.append(0)
l.show()
l.delete(10)
l.show()
l.push('LOL')
l.show()
l.delete('LOL')
l.delete(0)
l.delete(30)
l.delete(20)
l.show()
l.delete('df')