Equal or not


#1

is_true = 2+1==3

is_false = 2-1!=3

Oops, try again. It looks like is_false is true! It should be false


#2

What section is it, tell me i could help you


#3

You don't need to make any calculations.

== means equal
!= means not equal

So you have to figure out how to make both of these variables work.
See the right answer below, but try to figure it out yourself first!

is_true = 2 != 3
is_false = 2 == 3


#4

When you write 2-1!=3, what you are saying is "two minus one is not equal to three." This is true, because 2 - 1 = 1, not 3. Just remove the exclamation point: 2-1=3. Now you're saying, "two minus one is equal to three," which is false.

I think it's easiest to think of it this way: When you use a comparison operator (==), are you lying or are you being honest? You're being honest when you say, "two plus one is equal to three" because indeed, it is, so that makes the statement true. You're lying when you say, "two minus one is equal to three" (2-1=3) or, "two plus one is not equal to three" (2+1!=3), so each of those statements is false.

I think you got caught up in double negatives. The exercise was telling you to set is_false to something that is not true; it was not telling you to write an inequality (in which the numbers being compared actually are not equal), which is what you did. Be wary of this in the future, double negatives still trip me up sometimes!

I hope this makes sense!


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.