Can boolean expressions be combined?


Within the context of this exercise, can boolean expressions be combined into a longer expression?


Yes, we can combine multiple boolean expressions together to form a longer expression. For example, if we had the expressions,

Penguins are birds.


Penguins cannot fly.

we can combine them into a longer expression, either using an or or and operator which will be covered in the later exercises, resulting in

Penguins are birds AND Penguins cannot fly.

If we evaluated this for say an if statement, then this would become

True and True = True

and we might print out “Penguins are flightless birds” inside the if statement body.

This general idea is what we apply to boolean expressions in Python to combine multiple expressions together.


Armchair critic:

The logic that emerges here suggests that birds that cannot fly are penguins. At least slightly by my fuzzy logic.

Turkeys are birds that cannot fly, thank heaven for that come the autumn tradition. Can you imagine if ostriches could fly the havoc they would reak on a city? Penguins are pretty much confined to a locale. We would need to add that to our data parameters.


To critique the Armchair critic; you may want to work on your logic.
Penguins are birds = true
Penguins cannot fly = true
Notice that there is no “only” in either of these statements.
The notion that birds that cannot fly are (or must be) penguins is entirely an assumption or inference.
For example:
I take the bus to work = true
I do not own a car = true
This does NOT mean that: if you don’t own a car you MUST take the bus to work. Some people carpool, bike, or whatever.
I hope this made sense but in essence, stating something is true is not the same and stating that something is exclusively true.
So X = True
is not the same as
Only X = True


To do this, if you do not understand, refer to sets and set notations on math logic. Draw the sets out and you will understand the exercise.

sets and notations :
math logic :


Aggreed with madox1024. From an Aristotelian logical standpoint, here is what the statements in th example above prove:
All Penguins are Birds
All Penguins are Non-flying creatures.
Therefore, some birds are non-flying creatures.

1 Like

To add my beginner bit, i will mtf on this. Part of what we have to consider in writing our code is to make it as simple as possible for easy comprehension and possibly general applicability. While both arc9296573185 and madox1024 are very, i think it will be better if we can reduce the possibility of “weed inferences” or assumptions that do not represent what our code imply. In all, i am so glad i read this discussion as it also further shape my understanding for good. Thank you all


A post was merged into an existing topic: Welcome to our forums! Please Introduce Yourself