tionsort(arr))
> >
>
> Hint: what are you using 'pos' for? A placeholder for (something) has
> an actual purpose in the typical selection-sort, but you only initialize
> it and never use or update it.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/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
):
> if arr[b]>arr[a+1]:
> arr[b],arr[a+1]=arr[a+1],arr[b]
> return arr
>
> arr=[3,5,9,8,2,6]
> print(selectionsort(arr))
>
Hint: what are you using 'pos' for? A placeholder for (something) has
an actual purpose in the typical se
> 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
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[a+1]:
arr[b],arr[a+1]=arr[a+1],arr[b]