I know that abs()
can be used to convert numbers to positive, but is there somthing that does the opposite?
I have an array full of numbers which I need to convert to negative:
array1 = []
arrayLength = 25
for i in arrayLength:
array1.append(random.randint(0, arrayLength)
I thought perhaps I could convert the numbers as they're being added, not after the array is finished. Anyone knows the code for that?
Many thanks in advance