# Python Control Flow

#1

Hi

The exercise asks you to do the following:

Set the variable `statement_one` equal to the results of the following boolean expressions:

Statement one:

``````(2 + 2 + 2 >= 6) and (-1 * -1 < 0)
``````

I have entered the following code:

statement_one = (2 + 2 + 2 >= 6) and (-1 * -1 < 0)
print(statement_one)

and it returns False.

As both boolean expressions are True I expected True to be printed. However, I believe it’s returning false because -1 isn’t being accepted as a negative number.

Just wondering why this isn’t working as expected?

#2

you misread the instructions, but i see many people make that mistake

you need to set the variable to the result, so if you think `(2 + 2 + 2 >= 6) and (-1 * -1 < 0)` you should set statement_one to false:

``````statement_one = False
``````

unfortunately the exercise validation doesn’t enforce this, but it would be good to manually evaluate the conditions to learn evaluating conditions

please solve this math for me step by step:

``````(-1 * -1 < 0)
``````

so i can see where you go wrong

#3

This is a major facepalm moment! -1 x -1 = 1 and is therefore greater than 0!

I’m clearly overthinking everything and making silly mistakes! But thanks again for helping out.

#4

yep, good catch

do you now also understand what the best way to solve the exercise?

Sure, doing `statement_one =(2 + 2 + 2 >= 6) and (-1 * -1 < 0)` will get you to pass, but its not the best way to go if want to get the best out of the lesson. Manually evaluate the condition, then set the variable to the result.

#5

@gurpal89, you can give me the url of this exercise?

#6

#7

ah, its part of the computer science course, that explains why i couldn’t find it. Thank you

#8

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