Re: How to create linked list automatically

2005-12-20 Thread Peter Otten
Shahriar Shamil Uulu wrote: > Thank you very much to all, > we have figured it out, how to make it work, > w=[] > for i in range(10): >  node=Node(i) >  w.append(node) > > for i in range(10): > a=w[i] > if i+1>9: >b=w[9] >a.next=b > else: >b

Re: How to create linked list automatically

2005-12-19 Thread Shahriar Shamil Uulu
Thank you very much to all, we have figured it out, how to make it work, w=[] for i in range(10): node=Node(i) w.append(node) for i in range(10): a=w[i] if i+1>9: b=w[9] a.next=b else: b=w[i+1] a.next=b we have runned in this way

Re: How to create linked list automatically

2005-12-19 Thread Dave Hansen
On Mon, 19 Dec 2005 20:51:39 + in comp.lang.python, Simon Brunning <[EMAIL PROTECTED]> wrote: >I haven't the time (or inclination) to sort out all your problems >here, but one thing jumps out at me: > >On 12/19/05, Shahriar Shamil Uulu <[EMAIL PROTECTED]> wrote: >> class Node: >> def __ini

Re: How to create linked list automatically

2005-12-19 Thread Simon Brunning
I haven't the time (or inclination) to sort out all your problems here, but one thing jumps out at me: On 12/19/05, Shahriar Shamil Uulu <[EMAIL PROTECTED]> wrote: > class Node: > def __init__(self,name=None,next=None): > self.name=name > self.next=next > > def __str__(self

Re: How to create linked list automatically

2005-12-19 Thread Fredrik Lundh
"Shahriar Shamil Uulu" wrote: > w=[] > for i in range(10): > node=Node(i) > w.append(node) > > for i in range(10): > a=w[i] > if i+1>9: > b=w[9] > a.next=b I'm not sure what you're trying to do here, but I'm quite sure that this code doesn't do what you think it do

How to create linked list automatically

2005-12-19 Thread Shahriar Shamil Uulu
Hi All, i have this program, = class Node: def __init__(self,name=None,next=None): self.name=name self.next=next def __str__(self): return str(self.name) w=[] for i in range(10): node=Node(i)