Activity 4

Workshop Resources

Try printing out the answers to the following expressions using print. If the results for any of these statements don’t make sense, please ask for help!

Challenge:

Try making your own expressions!

Fun Fact: Connecting Booleans with AND and OR operators

You can also connect boolean expressions together using the AND and the OR operator. Here’s a chart that describes what happens when we connect booleans together:

ExpressionResult
True and TrueTrue
True and FalseFalse
False and TrueFalse
False and FalseFalse
True or TrueTrue
True or FalseTrue
False or TrueTrue
False and FalseFalse

To summarize, AND requires both boolean expressions to be true, while OR only requires one of the two Boolean expressions to be true. Here are some more examples:

What do you think the following expressions produce?