I'm trying to make a function that takes an input list parameter and do some math inside, returning a new list with the data collected from the math, but I'm always getting an empty list as a result. How do I need to pass the list to the function in order to get this to work?
inputArray = [12,6,7,3,8]
def derive (self, *inputArray):
outputarray = []
for i in inputArray:
operatorA = inputArray[i]
operatorB = inputArray[i+1]
if operatorA > operatorB:
operation = operatorA - operatorB
outputarray.append(operation)
else:
operation = operatorB - operatorA
outputarray.append(operation)
print(outputarray)
derive(inputArray)