bubblesort ctype sort Python -


for homework i'm trying make ctype array , pass bubble sort , return array. created array fine

arrsize = int(input("how many numbers? ")) nums = (arrsize*ctypes.py_object)(*range(arrsize)) random.shuffle(nums) print(nums[:]) 

and when pass bubble sort get: <main.py_object_array_15 object @ 0x0000000003949bc8> here bubblesort code.

def bubblesort(array):     in range(len(array)):         k in range(len(array) -1, i, -1):             if (array[k] < array[k-1]):                 swap(array, k, k-1)                 return array  def swap(a, x, y):     tmp = a[x]     a[x] = a[y]     a[y] = tmp 

the code run make work "sorta"

result = bubblesort(nums) print(result) 

does know im going wrong ive been looking @ ling i'm going cross eyed

if getting

<main.py_object_array_15 object @ 0x0000000003949bc8> 

as result only problem, should

print (list ( result)) 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -