Ex26.py: five = 10 - 2 + 3 - 5?

Hello everyone, I am going over Ex26 and if I understand correctly we need to make sure that the expression 10 - 2 + 3 - 5 EQUALS five?

Obviously I guess we are not supposed to change figures but to do what?.. Play around with math and parenthesis?

No matter where I place parenthesis, I am not getting ‘five’ as a result. I.e:

(10 - 2) + 3 - 5 = 6
10 - (2 + 3) - 5 = 10
10 - 2 + (3 - 5) = 6
10 - (2 + 3 - 5) = 10

…etc.

If the program ran OK then you are all finished. :slight_smile:

oh, alright! I see… Since instructions said “…Most of the errors are things Python will tell you, while some of them are math errors you should find…” I thought we were supposed to figure out the math thing too but thank you for clarifying that.

I just changed the 5 to a 6… so I would get 5. ?

2 Likes

Throw in some more of PEMDAS. Multiplication and division the move the parens around and you’ll get an idea of where those are. Right now you’re doing just + and - so it’s the same level in the PEMDAS hierarchy.

1 Like

The real ans is here… Pemdas.xyz