The boolean operator and returns True when the expressions on both sides of and are true


#1


Hello, I am trying to pass this exercise, I have tried a bunch of different results but nothing works. Can someone provide me solutions on how to proceed? Thanks!

The boolean operator and returns True when the expressions on both sides of and are true. For instance:

1 < 2 and 2 < 3 is True;
1 < 2 and 2 > 3 is False.
Instructions
Let's practice with and. Assign each variable to the appropriate boolean value.

Set bool_one equal to the result of False and False
Set bool_two equal to the result of -(-(-(-2))) == -2 and 4 >= 16**0.5
Set bool_three equal to the result of 19 % 4 != 300 / 10 / 10 and False
Set bool_four equal to the result of -(1**2) < 2**0 and 10 % 10 <= 20 - 10 * 2
Set bool_five equal to the result of True and True

https://www.codecademy.com/courses/python-beginner-BxUFN/2/2?curriculum_id=4f89dab3d788890003000096#


"Double check your value for bool_four!"


bool_one = 5<4 and 8>9

bool_two = False and True

bool_three = True and False

bool_four = False and False

bool_five = True and True


#2

Hi @arcmaster06320,

For this exercise I think they are testing whether you understand the concept of "and".

As mentioned, True is only returned when the expressions on both sides of "and" are true. For this exercise, you are trying to determine if each boolean will return True or False based on the given conditions.

Taking bool_one as an example:

Since False and False are both False, you should key in bool_one = False

Taking bool_two as an example:

Since the first part is False, and the second part is True, overall, bool_two will still return False since only the expression on one side of the "and" statement is true, while the expression on the other side of the statement is False.

Hence, you should key in bool_two = False

Just carry on accordingly with the rest of the booleans...especially since you're already midway there by figuring out whether the expressions on each side of each "and" statement are True or False.

Hope this helps :slight_smile:


#3

Thank you so much! I knew I was close, I just couldn't figure it out! First time ever learning programming... a lot to learn!


#4

You're welcome :slight_smile:

Python is also my first programming language, and I am currently at Unit 5: Python Lists and Dictionaries myself :stuck_out_tongue: Let us work hard together :slight_smile: