2

I ran the following program on Python IDLE

while x<1000:
    print(x**x)
    x=x-1

And received the following output: Alternating positive and negative numbers for a while (like long float numbers with alternating signs) Then came this part, which was puzzling.

-0.0
0.0
-0.0
0.0
-0.0
0.0

Why does Python show it as negative and positive zero? Isn't that just plain wrong?

0 Answers0