a = -2.5427 

must be

 a = 2.5427 

    4 answers 4

    You want to reverse the sign.
    Everywhere it is done like this:

     a = -a 
       >>> a = -2.5427 >>> a -2.5427 >>> a = abs(a) >>> a 2.5427 

      https://pythonz.net/references/named/abs/

        Obviously, this is done by changing the sign: You can either assign the opposite sign to the number a=-a , a=a*(-1) , or take this number by the absolute value . Keep in mind that the numbers in the Python language are immutable , and therefore it is better, changing the sign, to assign the number to another variable - b=-a or b=abs(a) or b=a*(-1)

        • one
          Numbers are immutable, and values ​​in variables (bound to variables) are variable. Therefore, it is not necessary to assign the value to a different variable, it can be the same. - insolor
         a *= -1 # То же самое как а = a * -1