You do some weird things:
A = Cell(8,Cell(9,Cell(10)))
assumes your cell is like
class Cell(object):
def __init__(self, val, nxt=None):
self.val = val
self.next = nxt
C = Cell(A)
, A, .
, Cell, :
class Cell(object):
def __init__(self, val, nxt=None):
self.val = val
self.next = nxt
def copy(self):
if self.next is None:
return Cell(self.value)
else:
return Cell(self.value, self.next.copy())
concat :
def concat_copy(a, b):
new = a.copy()
last = new
while last.next is not None:
last = last.next
last.next = b.copy()
, :
def copy( cells ):
new = Cell(cells.value)
current = new
old = cells
while old.next is not None:
ccopy = Cell(old.value)
current.next = ccopy
current = ccopy
old = old.next
return new
, , : , C = Cell(A,C) C, .