Re: [Tutor] about recursion code

2004-12-07 Thread Alan Gauld
> def selection_sort(lst,start,end): > """sort the lst from selection start to end""" > if len(lst)==1: > return lst > elif lst=="": > return "" > else: > return lst[:start]+selection_sort(lst,start+1,end) This doesn't appear to do any actual sorting? And th

Re: [Tutor] about recursion code

2004-12-06 Thread Guillermo Fernandez Castellanos
Usually, in case of doubt, use a debugger or print statements: def selection_sort(lst,start,end): """sort the lst from selection start to end""" print lst, start, end if len(lst)==1: print "list of size 1" return lst elif lst=="":

[Tutor] about recursion code

2004-12-06 Thread Lin Jin
hello,tutors: i am working on the recursion of selection sort,and my code is: def selection_sort(lst,start,end): """sort the lst from selection start to end""" if len(lst)==1: return lst elif lst=="": return "" else: return lst[:start]+selection_sort(lst,start+1,en