Skip to content
Advertisement

python – weird results with exponent operator in idle

I’m getting a strange result when squaring -1 in idle. What’s going on?

Unexpected result:

JavaScript

Expected result:

JavaScript

Advertisement

Answer

Operator precedence (the - is a unary minus operator):

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement