[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Negative number positive
If you want something that converts negative numbers to positive
numbers, but leaves positive number alone, use the *abs()* function.
a = abs(b)
If you want something that has the effect of multiplying by -1, just use
the - operator.
a = -b
Ken Seehart
Farai Aschwanden wrote:
Hello
Erm, not a Pygame 1.8 question but just cant find the the needed
function: I would like to make a negative number to a positive number,
like -5 -> 5
Quite easy, just cant find the Python function (if there is one). Sure
I could multiply the negative value by -1 but I would prefer using the
convention function. Is there one and what is it called?
Thanks in advance
Farai