For homework i'm trying to make a ctype array and pass it into a bubble sort and return my array. I created the array just fine
arrSize = int(input("How many numbers? "))
nums = (arrSize*ctypes.py_object)(*range(arrSize))
random.shuffle(nums)
print(nums[:])
and when i pass it into my bubble sort i get: <main.py_object_Array_15 object at 0x0000000003949BC8> Here is my bubblesort code.
def bubbleSort(array):
for i in range(len(array)):
for 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 that i run to make it work "sorta" is
result = bubbleSort(nums)
print(result)
does anybody know where im going wrong ive been looking at this for so ling i'm going cross eyed
if getting
as the result is your only problem, then you should