Python‎ > ‎operator‎ > ‎

operator.mul()


Definition
Returns with the multiplication of a*b.

Syntax
operator.mul(a,b)

Parameters
operator.mul(a,b)


Examples
The method returns with:
 >>> variable_a=55
>>> variable_b=33
>>> operator.mul(variable_a,variable_b)
1815


a*b
Return is:
 >>> variable_a=55
>>> variable_b=33
>>> variable_a*variable_b
1815

operator.__mul__
Equivalent to:
 >>> variable_a=55
>>> variable_b=33
>>> operator.__mul__(variable_a,variable_b)
1815

The returns is:
 >>> a= Decimal(2.31).compare_total_mag(Decimal(9.22))
>>> b=Decimal('-1')
>>> operator.mul(a,b)
Decimal('1')
>>>

math.sine.__mul__()
The input() value returns the math.sin(a)*2-1
import math
import operator
a=float(input("Please enter sine(value) : "))
b=math.sin(a).__mul__(2).__sub__(1)
print(b)
>>> 
Please enter sine(value) : 2.2
0.6169928076391802
>>>


math.copysign()__mul__
The equation value is determined through input().
import math
import operator
a=float(input("Please enter copysign(x) : "))
b=float(input("Please enter copysign(y) : "))

c=math.copysign(a,b).__add__(1.1).__mul__(math.acosh(2)).__truediv__(math.atan2(88,34))
print("The equation value is", c)

>>> 
Please enter copysign(x) : 2
Please enter copysign(y) : 6
The value is 3.3961966891396522
>>> 


Decimal().__mul__(Decimal()
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