# Mix 'n' Match

#1

Stuck on this error that doesn't make sense! Who knew I would have to deal with bugs before I even learn to code!

Error:
File "python", line 10
bool_three = 1 == 3 and 2 == 3
^
SyntaxError: invalid syntax

Code:

# Make me false!

bool_one = (2 <= 2) and "Alpha" == "Bravo" # We did this one for you!

# Make me true!

bool_two = 4 == 5 or not(not(7 * 3 >= 21)

# Make me false!

bool_three = 1 == 3 and 2 == 3

# Make me true!

bool_four = 1 ** 789089 > 2 * 1 or 5 ** 2 > 2 * 5

# Make me true!

bool_five = not (9 * 2 > 9 + 2) or (1 = 1)

#2

For bool_three, you are stating that 1 is equal to 3, and so is 2 equal to 3. That seems true to the operator. Why not just state to the operator something is already false, like `2 <= 1`? That doesn't look correct at all. Play with different numbers (but try to keep it simple and not complicated for learning's sake).

#3

How is 1 == 3 and 2 == 3 recognized as True to the operator?. Each individual statement is clearly False. From a previous section False and False is to be recognized as False. Please give me further clarification because in my mind this is still and error on code academy's part...

To Be and/or Not to Be

"""
Boolean Operators
------------------------ True and True is True
True and False is False
False and True is False
False and False is False

#4

Sorry for a late response. I'll try my best to clarify here. Let's forget about anything dealing with the operator right now. Instead, let's think of regular math here.

When you write 1 = 3 and 2 = 3, you are basically writing that that number 1 is equal to number 3, and that number 2 is equal to number 3. It's as if it's saying "x = 3" and "y = 3," and it just so happens that the numbers you are given to define "x" is 1 and "y" is 2 (or in other words, you have (1, 2), which is something you would see regularly in Algebra). You are stating that that is what it is, and since there is no other functions going into it (i.e. +, -, /, *), that it is definite.

Now, with the above said, if you were to change the formula to as follows: (1 + 2) = 3, now you have set a calculation. You have a "+" symbol, meaning that whatever comes before and after it will produce the answer. So if it's (1 + 2) = 3, this is a correct answer (true). Why? Because the numbers 1 `+` 2 truly do equal 3. However, if you were to write (2 + 2) = 5, this is wrong (false). Why? Because the symbol "+" is looking for the numbers before and after it to produce the correct calculation, which is 4, but it has an error because how can it equal 5? This is the cause for this being `false`.

I've used technical terms in order to get across my point. I hope this was able to clarify more and was found helpful. If it wasn't I'm sorry in advance for not getting a better concept for you.

#5

OK I hear what you are saying but need to follow up with one more question. Below is what I entered when it worked... neither of those are equations as you stated above. Also I was under the impression that, at least for Python, if you wanted to set a value equal to something like x = 3 you would only use one = where if you are writing an equation you would use the double ==. So 1 = 3 would say that 1 is 3 but if i say 1 == 3 then that is False.

This worked!

# Make me false!

bool_three = 1 == 3 and 3 == 3

False and True = False!

#6

did this work for anyone : 1 == 3 and 2 == 3

#7

So you have thrown off everything I stated. Looks like I need to do more research than I originally thought. (@kirancoding04) I just tried to work with `1 == 3 and 2 == 3`, and also `1 == 3 and 3 == 3`, and I was still able to move through the the exercise. This was strange previously beforehand. Well, you made it past, so good job!

#8

unfortunately, this did not work for me. Does somebody else has any suggestions what should work?
I used this code:

# Make me false!

bool_one = (2 <= 2) and "Alpha" == "Bravo" # We did this one for you!

# Make me true!

bool_two = 4 == 5 or not(not(7 * 3 >= 21)

# Make me false!

bool_three = (2 <= 2) and "Alpha" == "Bravo"

# Make me true!

bool_four = 1 ** 789089 > 2 * 1 or 5 ** 2 > 2 * 5

# Make me true!

bool_five = not (9 * 2 > 9 + 2) or (1 = 1)

#9

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