-(-(-(-2))) == -2 and 4 >= 16**0.5

#1

I am embarrassed ... it's stupid, but I don't understand the left and right part of this equation... Could you advise me the educational site where I could learn and understand its sense? Wish it were as simple and clear as CodeAcademy with its Python... Good bye so far and best wishes

#2

If you do not understand it, throw it into the interpreture one part at a time.

First

``````-(-(-(-2)))
# OUTPUT: 2``````

Then

``-2``

Then an `and`

Then

``4 >= 16**0.5 # Basically what is the square root``

So all together w/o any fancy junk

``2 == -2 and True``

As you can see quickly now that there is no way that 2 == -2 and 4...

#3

In math, the `-` sign changes the sign of the value coming after it:

`` -(-5) = -1 * -5 = 5``

You can do this as many times as you like:

``-(-(-(-(-5)))) = -(-(-(5))) = -(-(-5)) = -(5) = -5``

And python respects this aspect of math. And it does exactly what I did there with the -5, it evaluates the expression as many times as possible until its impossible to reduce. Then goes on to the rest of the expression. So when it sees the whole `-(-(-(-2))) == -2 and 4 >= 16**0.5` it will first take the `-(-(-(-2)))`, and before continuing to the rest of the stuff will reduce this to something readable.

``-(-(-(2))) = -(-(-2)) = -(2) = -2``

then continue with the rest:

``-2 == -2``

Which is `True`. As it finds the `and` it has to evaluate the whole right-hand stuff before actually computing the `and`.
Then, `4 >= 16**0.5`, as you know evaluates to `True`, and finally python will evaluate `True and True` which returns `True`.

#4

Yea, that is not how that works...

It's like this

``````-(-(-(-2))) == -1 * ( -1 * (-1 * ( -2)))
# OUTPUT: True``````

Also a negative is like flipping a switch in regards to it's positive or negative nature. It never moves the number's absolute value but it does flip it's `switch`.

And as I stated previously, if you do not understand something `Google` it or throw it in to the interpreter. Worst case is you get an error.

Also i forgot about the comparative statement at the end thanks for reminding me I fixed ma previous post!

#5

I can't understand this math either, and I just don't know how to continue with the lessons. Do I have to stop here and find another Python class at another site?

#6

I don't have time to waste on just one line, the math of which I could not understand. So I cheated and copied a solution and moved on. Nice... I breezed through several more assignments and I'll stay with these lessons.

No help needed.

#7

-2 == -2 True
-(-2) == -2 ,False, porque -(-2) = 2
-(-(-2)) == -2 , True, -(-(-2)) = -2
-(-(-(-2))) == -2 , False, -(-(-(-2))) = 2
4 >= 16**0.5 ,True, porque 16**0.5 Ă© 4
bool_one = False and False

bool_two = True and False

bool_three = True and False

bool_four = True and True

bool_five = True and True

#8

i feel so stupid looking at the maths in this seems its suppossed to be easy but can some one and try and explain this -(-(-(-2))) what are all of the brackets doing?

#9

I don't understand either. I calculated is 2, how come -2 ?

-(-(-(-2))) == -1 * ( -1 * (-1 * ( -2)))
= -1* (-1* (2)
=-1* (-2)
=2
That's what I calculated

• - = +
• + = -
• + = +
• = -

#10

Itâ€™s Simple if the no. of negative signs are odd then the result will be negative and if the no. of negative signs are even then the result will be positive.

example : -(-(-2)) = -2 and -(-2) = 2

#11

I was stuck on this one as well. The program does not teach you what multiple negatives do (whether in parentheses or not). It also expects you to know maths you may or may not have any grasp of without teaching it to you first. Breezing through the learn python courses and getting completely stuck at this point was not fun. Iâ€™m glad I found the answer here in the end as when i googled for the answer, it just gave me the answer of -(-(-(-2))) = 2 without telling me how to work it out, and I didnâ€™t know that switching to positive or negative was a thing (maths is by far my weakest subject). This is the stuff which has always made me question whether I could become a coder, I canâ€™t do maths, at least not to this degree. I understand it now, but if problems like this are common, and get harder using complex algebra or calculus I wonâ€™t be able to do it.

#12

This is not entirely correct, or is a little too basic in its explanation anyway.
The equation ( - 2) - ( - 4) = 2
You will notice there are an odd number of minus symbols but the answer is 2.
Similarly, the equation -2 - 4 = -6.
However, in the first equation, the numbers in the parentheses are both negative numbers and regardless of the function (multiplication, division, plus, minus) we will end up with a positive number.
An explanation I found on the net puts it like this:

When I say â€śEat!â€ť I am encouraging you to eat (positive)
But when I say â€śDo not eat!â€ť I am saying the opposite (negative).
Now if I say â€śDo NOT not eat!â€ť, I am saying I donâ€™t want you to starve, so I am back to saying â€śEat!â€ť (positive).

So if there is only one negative number or an odd number of negative numbers in the equation, the answer will also be negative. If there are an even number of negative numbers in the equation, then the answer will be a positive.

If you would like it explained further, this is the site I found my answers:
https://www.mathsisfun.com/multiplying-negatives.html