Your first function must return something if you want to pass that result to second function. Please, see the following example:
def main(n):
array = []
for x in range(n):
array.append(random.randint(0, 5))
return array
def sortarray(array):
newarray = []
for i in range(len(array)):
newarray.append(array.pop.array(array.index(max(x))))
return newarray
And you could use them like the following:
print(sortarray(main(5)))
BTW, if you're interested in sorting - you definitely should checkout Sorting HOW TO.
UPDATE
That will give the following error:
<ipython-input-1-d0f89860ca87> in sortarray(array)
8 newarray = []
9 for i in range(len(array)):
---> 10 newarray.append(array.pop.array(array.index(max(x))))
11 return newarray
AttributeError: 'builtin_function_or_method' object has no attribute 'array'
As you can see it's pointing to the following line:
newarray.append(array.pop.array(array.index(max(x))))
And the problem is in the array.pop.array call. array.pop is a function.
list? So you know how to pass argument to function; why not passarrayif you need it in a function? (You need to get the returned value from first function before doing so).