# FAQ: Control Flow - Relational Operators: Equals and Not Equals

This community-built FAQ covers the “Relational Operators: Equals and Not Equals” exercise from the lesson “Control Flow”.

Paths and Courses
This exercise can be found in the following Codecademy content:

## Join the Discussion. Help a fellow learner on their journey.

Agree with a comment or answer? Like () to up-vote the contribution!

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I don’t understand what the instruction is in this exercise, as copying the example receives SyntaxError: invalid syntax

.>>> 1 == 1
True
.>>> 2 != 4
True

And this instruction is not explained:

Input your answer as `True` or `False` in the appropriate variable to the right.

statement_one = (5 * 2) - 1 == 8 + 1

statement_two = 13 - 6 != (3 * 2) + 1

statement_three = 3 * (2 - 1) == 4 - 1

Where do I put true or false?

2 Likes

I am having the same issue. I entered “true” and “false” like the last exercise. The instructions are unclear.

Are you making sure to write “True” and not “true”? I was having the same issue and then was able to fix it by capitalizing.

3 Likes

You just need to type it without the " "

statement_one = True

statement_two = False

statement_three = True

3 Likes

A post was split to a new topic: Writing factorials within python

Why this is False please someone explain to me
13 - 6 != (3 * 2) + 1

You might want to look into Python’s operator precedence, that is, in which order should operators act-
https://docs.python.org/3/reference/expressions.html#operator-precedence

Expressions in parentheses are evaluated first and so on such that all those mathematical operators are evaluated before the `!=` comparison, with the step before the comparison effectively looking like- `7 != 7` which of course evaluates to `False`.

1 Like

thanks, tgrtim for this explanation

1 Like

Why do we use quotation marks around some words (ie, the last lesson about Boolean expressions) but in the lesson about relational operators, True and False don’t have quotation marks around them?

1 Like

I assume you’re referring to things like ‘word’ or “word”? In Python this is a string literal and it creates a string type (it’s an immutable sequence made up of the Unicode character values, for characters ‘w’, ‘o’, ‘r’ and ‘d’ in this case). Whereas `True` on its own is boolean value `True`.

So `True` is not quite the same thing as `'True'`, they don’t share the same type and therefore act quite differently. Hopefully that makes a little more sense.

2 Likes

This order of operations is incorrect?

13-6 != (3 * 2) + 1
7 != (6) + 1
7 != 7

I still don’t think I understand. Can anyone break this down a little more for me?

Welcome to the forums!

``````13-6 != (3 * 2) + 1  # starting expression
13-6 != (6) + 1      # evaluate what's inside the brackets
7 != 7               # do addition and subtraction
False                # final result after using !=
``````

The link @tgrtim put in his post contains a table listing what order operators are evaluated in, from first to last. If you apply that to the above expression, you’ll find that anything in brackets is evaluated first, followed by addition and subtraction from left to right, followed by the `!=` comparison operator.

1 Like

Codecademy hasn’t taught precedence yet. Anything inside ( ) is calculated first. 3 * (2 -1) == 3 * 1, True. “=” means assign whereas “==” mean comparison. “!=” is not equal to.

Thankyou so much, I was pulling my hair out about this! When I went back and checked the task instructions do show Tue and False without the quotation marks but I just hadn’t noticed. Especially having come straight from the previous tasks when they get you to answer within quotations. Maybe a clever trick by the question author to get us to scrutinise the instructions thoroughly lol.

1 Like