Re: Selection sort

2021-12-24 Thread Luca Anzilli
Hello try this code def selectionsort(arr): #le=len(arr) for b in range(0,len(arr)-1): # pos=b for a in range(b+1,len(arr)): if arr[b]>arr[a]: arr[b],arr[a]=arr[a],arr[b] return arr arr=[3,5,9,8,2,6] print(selectionsort(arr)) Il giorno ven 24 d

Re: Selection sort

2021-12-24 Thread dn via Python-list
On 25/12/2021 03.22, vani arul wrote: > Hello, > I am trying write a code.Can some help me find the error in my code. > Thanks! > > > def selectionsort(arr): ># le=len(arr) > for b in range(0,len(arr)-1): > pos=b > for a in range(b+1,len(arr)-1): > if arr[b]>ar

Re: Selection sort

2021-12-24 Thread Mats Wichmann
On 12/24/21 07:22, vani arul wrote: > Hello, > I am trying write a code.Can some help me find the error in my code. > Thanks! > > > def selectionsort(arr): ># le=len(arr) > for b in range(0,len(arr)-1): > pos=b > for a in range(b+1,len(arr)-1): > if arr[b]>arr[

Re: Selection sort

2021-12-24 Thread Barry Scott
> On 24 Dec 2021, at 14:22, vani arul wrote: > > Hello, > I am trying write a code.Can some help me find the error in my code. > Thanks! > > > def selectionsort(arr): > # le=len(arr) >for b in range(0,len(arr)-1): >pos=b >for a in range(b+1,len(arr)-1): >if