I dont Understand


#1

Use boolean expressions as appropriate on the lines below!

Make me false!

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

Make me true

bool_two = (2 + 2) and (2 + 2)

Make me false!

bool_three = (2 + 2) not 4

Make me true!

bool_four = (3 + 6) or 9

Make me true!

bool_five = 8 and 8


#2

In order for us to help you, we’re going to need a few things:

  • A link to the lesson
  • Any and all error messages you have received

If you provide these things, we will be better able to help you.


#3

https://www.codecademy.com/courses/learn-python/lessons/conditionals--control-flow/exercises/mix-n-match?action=lesson_resume

File “python”, line 10
bool_three = (2 + 2) not 4
^
SyntaxError: invalid syntax


#4

Alright, the issue here has to do with what you are telling your variables to evaluate. For instance,

This would evaluate to 4 and 4, whereas it needs to evaluate to true.

In order to resolve this, the expressions (i.e. 2 + 2, 4, etc.) should ideally not be mathematical operations (i.e. +, -, *, /, etc.), but mathematical comparisons.

To make mathematical comparisons in Python, we use comparators, such as:

  • Greater Than (>)
  • Less Than (<)
  • Greater Than or Equal to (>=)
  • Less Than or Equal to (<=)
  • Is Equal to (==)

#5

But how do i use and or and not


#6

true, but then python will evaluate if 4 is true. Its not as ideal as using mathematical operators, but its possible

but what you do here:

bool_three = (2 + 2) not 4

is not possible, not can be used to convert True to False (not True -> False, not False -> True)

or and and can be used if you want to evaluate multiple conditions

but @aquaphoenix17 suggestion is good, you could do 2 + 2 == 4 for bool_three, they are equal so the condition evaluates to True, then we can use not keyword to make the condition False

yes, mathematical operators can be used along or and and


#8

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