Home>

I'm not sure how to use Boolean type.
I'm told to search for the following example and check with the given code, but I am not sure where and what to check.
In this example, (A and B) or C is not the same as A and (B or C).

For example, considering a set, if x=15 and A = x<10, B = x >2, C = x<20, then True and Fales. So I think it's an example.
However, when asked to confirm this below, I don't really understand how A, B, and C can do it.
An error will occur if a formula is simply assigned to A, B, or C.

def etest():
    print(" A B C | (A and B) or C A and(B or C) ")
    for A in [True, False]:
        for B in [True, False]:
            for C in [True, False]:
                print (A,B,C,"|"," ",(A and B) or C," ", A and(B or C))
etest()


Also, if another problem is that x is an odd negative number or an even number that is greater than 10, how can I express this as a simple boolean expression in python?

I can understand the meaning of logical expressions, but when I use python, I don't know what to do.
I am afraid that I have a vague question because I do not understand my intention. Thank you.