我试图通过递归方法编写反向函数, 不知怎的,它没有返回。有人可以帮忙吗?非常感谢。
def reverse(S, start, stop):
if start>=stop:
return False
elif start<stop-1:
S[start], S[stop-1]=S[stop-1], S[start]
reverse(S, start+1, stop-1)
# test the code
myList=[2, 3, 4, 5, 51, 66, 88, 234, 444]
print "input sequence is : "+str(myList)
print reverse(myList, 0, len(myList))