On Thu, May 23, 2013 at 7:51 PM, <lokeshkopp...@gmail.com> wrote: > i had written the following code i am unable to create the instance of the > class "Node" in the method "number_to_LinkedList" can any one help me how to > do ?? > and what is the error??
It would really help if you post the actual exception and traceback. It's UnboundLocal, not Unbounded... and here's the problem: > def number_to_LinkedList(numbers): > head_node = Node() #unable to create the instance saying UnboundedLocal > while Node: > print Node.data > Node = Node.next You're assigning to Node. I think you mean to have some other local variable here, for the iteration at the end. Since you assign to the name Node inside the function (and don't have a global declaration), the name Node is local to the function. Python doesn't let you reference the global "prior to" shadowing it with the local, so you get this error. ChrisA -- http://mail.python.org/mailman/listinfo/python-list