Python‎ > ‎decimal‎ > ‎

Decimal.logical_and()


Definition
Return the digit-wise and of the two (logical) operands.

Syntax
Decimal(x)logical_and(other, context=None)

Parameters
x=digit
other=digit

Examples
The returns are:
 >>> Decimal('0').logical_and(Decimal('1'))
Decimal('0')
>>> Decimal('0').logical_and(Decimal('0'))
Decimal('0')

>>> Decimal('1').logical_and(Decimal('0'))
Decimal('0')

>>> Decimal('1').logical_and(Decimal('1'))
Decimal('1')
>>>

Decimal().logical_and ().__eq__Decimal().logical_and ()
The method test the equality tow Decimal equations.
from decimal import Decimal

x=(Decimal(1).logical_and(Decimal(1))).__sub__(Decimal(0).logical_and(Decimal(1)))
y=(Decimal(1).logical_and(Decimal(1))).__mul__(Decimal(0).logical_and(Decimal(1)))
print(x.__eq__(y))

>>> 
False
>>>


Comments