class No:
def __init__(self,a,b):
self.val = a
self.next = b
def __str__(self):
return "%s->%s"%(self.val,self.next)
def swapandReverse(lista):
n2 = lista.next #2nd element
n2.val,n2.next.val = n2.next.val,n2.val #swap 2,3
n = lista #root node
v = [] #hold our values
while n.next:
v.append(n.val) #add our value to list
n = n.next #move to next node
v.append(n.val) #append value of last node in the list
while len(v): #as long as we have values left in list
n.next = No(v.pop(-1),None) #set next to new node with our val
n = n.next
lista = No(3,No(1,No(4,No(2,None))))
print lista
swapandReverse(lista)
print lista
at least something like that