Good morning. I am surprised by the use of " * " as logical AND, if I understand correctly what Moroney is explaining in the attached diapo.

Can someone explain me this use of " * " ? I have googled a little but I was not able to find that “*” can substitute the “AND”.

Thank you in advance for answering.

I haven’t listened to the lecture for a long time, but my impression is that you have two vectors containing only 1 and 0 values being multiplied together using the * to produce a new vector containing only 1 and 0 values. It’s still technically a math operator, but pragmatically it acts as a logical operator because of the outcome. Maybe I missed something.

Here is an excerpt from the Python 3.10.8 doc…

## 6.7. Binary arithmetic operations

- The
`*`

(multiplication) operator yields the product of its arguments. The arguments must either both be numbers, or one argument must be an integer and the other must be a sequence.

Thank you. You are right. It is the math operator used as a logical one.

1 Like