I am trying to convert a list that contains negative values, to a list of non-negative values; inverting the negative ones. I have tried abs but it didn\'t work
abs
what you want is to use the absolute value (|x| = x if x > 0, |x| = -x if x < 0)
for index in range(len(x)): x[index] = x[index] if x[index] > 0 else -x[index]