Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

No Title - Different type of 'error'? (True, False)

$
0
0

a, b in RealNumber, it should be always ‘TRUE’…

a > (a+b)/2 > b AND a**2 + b**2 >= 2*a*b

But, why ‘False’?

r = range

A = {(a > (a+b)/2 > b) is True
     for a in r(-10, 10)
     for b in r(-10, 10)
     }
print(A)

 >> {False, True}  # should be only True

B = {(a**2 + b**2 >= 2*a*b) == True
     for a in r(-100, 100)
     for b in r(-100, 100)
     }
print(B)

>> {True}

A different try:

C = {True if (a**2 + b**2 >= 2*a*b) else False
     for a in r(-100, 100)
     for b in r(-100, 10)}
print(C)

D = {True if (a > (a+b)/2 > b) else False
     for a in r(-10, 10)
     for b in r(-10, 10)
     }
print(D)

5 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles