And now this

And Now This

The and operator checks that the boolean conditions on both sides of it are True. You can combine multiple and statements together if you need more than two conditions to be checked.

true_condition = True
false_condition = False
santiagos_birthday = False

result1 = true_condition and false_condition # False, because both sides aren't True
# Two `and` keywords to check three conditions
result2 = true_condition and not false_condition and not santiagos_birthday # True

Complete the code to practice with some and statements.

Test Cases

test result1 - Run Test

def test_result1():
    assert result1 is False

test result2 - Run Test

def test_result2():
    assert result2 is True

Solution 1

you_shall_pass = not True
the_time_is_now = "a" in "apple"
false_variable = False

# Use `and` to check if you_shall_pass and the_time_is_now both evaluate to true
result1 = you_shall_pass and the_time_is_now

# Now use two `and`s to on all three variables at the top, and use your knowledge of `not` to make this and statement result be True
result2 = not you_shall_pass and the_time_is_now and not false_variable
you_shall_pass = not True the_time_is_now = "a" in "apple" false_variable = False # Use `and` to check if you_shall_pass and the_time_is_now both evaluate to true result1 = ? # Now use two `and`s to combine all three variables at the top, and use your knowledge of `not` to make this and statement result be True result2 = ?