Control flow syntax error


On this exercise I keep on getting the error message ‘File “python”, line 3
SyntaxError: can’t assign to operator’. Here are my answers…

bool_one = 7 < 4 and 2 * 5 < 3

bool_two = 32 + 3 = 35 and 11 >= 7 * 2

bool_three = 20 % 5 = 3 and 14 / 2 = 6

bool_four = 1 ** 2 = 1 and 12 % 10 = 10

bool_five = 2 ** 0 = 2 and 10 % 12 = 2

Any help greatly appreciated


the problem is here:

32 + 3 = 35

you want to assign 32 + 3 a value of 35, that doesn’t work, you can check if they are equal using two equal signs

but you got the whole exercise wrong,for example for bool_one we have to analyze if False and False is true or false, well clearly this is false, so we should set bool_one to this result (false):

bool_one = False

same for the other bool_two till five


Using the computer to solve the expressions is cheating. We need to be teaching our brain how to recognize these expressions and evaluate them in our head, or on paper. Only the result should be given as an answer, as previously mentioned.


One shortcut to learn and practice when working with AND is, look for the False exprression. AND must be true in both operands, and will short-circuit on False.

7 < 4  =>  False. Stop there.

11 >= 7 * 2  => False

Something I just noticed in your cheat code, 32 + 3 = 35 is not a valid comparison. It should use == to test for equality.

Go over every expression visually, and only the ones with no False operands will be True.


Cheat code? Sorry but I don’t get it. Anyways, turns out all I had to do was copy the exact calculations they had written and apply it to the bools. Although what you say about the == is true. Thanks for the help anyways


Which is cheating. Maybe you don’t mind not learning?


Still don’t get you mate. I wasnt “cheating”. I thought the question was telling me to to work out if the answers where true or false, and then write my own calculations which would result in the same conclusion. And I’m very interested in learning this, that’s why I post to try and get peoples help in understanding this, which isn’t bad for someone who has never done coding. So like I said, thanks


i think that is not cheating, if you manually evaluate the condition provided by the exercise, and then write a custom comparison to match the Boolean value you where to set, its additional practice

i also explained the syntax error you got


That’s true. Thanks. Il remember that next time :slightly_smiling_face:


you can’t assign integer to integer value, did you manage to solve problem by check if 32 + 3 equals 35?


If you learned more about expressions and how to recognize and evaluate them, then what you did would be fine. I’m only harping about how important it is to not have the computer solve the problem for us. It should be in our head. This and the few other exercises that follow all present the same way. One should take full advantage of the opportunity it presents, and work out other examples as well before moving forward. This is very important stuff. Don’t cheat yourself out the benefit of engaging your brain in these exercises.

There are one or two exercise where you will need to create some expressions that return True or False, but this one is not one of them.


Yes, I had to use the double equals instead of one


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