0

Why does 1+-+1 equal to 0? If there is something mentioned in the documentation about this, could you link to it?

0

1 Answer 1

2

This

1 + - + 1 

Expands to

1 + ( - ( + 1)) == 1 + (- 1) == 1 - 1 == 0 

Read more about evaluation order here.

Sign up to request clarification or add additional context in comments.

1 Comment

"Python evaluates expressions from left to right". Thank you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.