__add__


Definition
Operator will add the values.

Syntax
__add__

Parameters
number

Examples
fraction__add__fraction
The method added the values.
 >>> Fraction(1).from_decimal(1).__add__(Fraction(0,1))
Fraction(1, 1)


The fraction is added by:
 >>> Fraction(2,3).numerator.__add__(2)
4


Returned to following:
 >>> Fraction(0,1).real.__add__(Fraction(0, 1))
Fraction(0, 1)


Fraction values are added.
 >>> Fraction(2.111300).limit_denominator(1).__add__(Fraction(2, 1))
Fraction(4, 1)

math.__add__math
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
>>> 


set(Decimal()).__add__set(Decimal())
The returns are following:
from decimal import Decimal
import itertools

set1={Decimal(0.1).to_integral_value(),Decimal(1.9).to_integral_exact(),
                        Decimal(1.5000001).to_integral()Decimal(10).shift(2)}
set2={Decimal(1).scaleb(0),Decimal(1).remainder_near(2),Decimal(1.0000).normalize()}

print("The decimal values of set1 are:", set1)
print("The decimal values of set2 are: ", set2)

max_set1=int(max({Decimal(0.1).to_integral_value(),Decimal(1.9).to_integral_exact(),
Decimal(1.5000001).to_integral(), Decimal(10).shift(2)}))
print("The maximum integer value in set1 is: ",max_set1)

min_set2=int(min({Decimal(1).scaleb(0),Decimal(1).remainder_near(2),Decimal(1.0000).normalize()}))
print("The minimum integer value in set2 is:",min_set2)

set3=max_set1.__add__(min_set2)
print("The set1 added by set2 is: ", set3) 

set4=max_set1.__lt__(min_set2)
print("The max_set1 is lessor than min_set2:", set4)

x=set1.difference(set2)
rint("The set1 difference to set2 is :", x)

>>> 
The decimal values of set1 are: {Decimal('1000'), Decimal('0'), Decimal('2')}
The decimal values of set2 are: {Decimal('1')}
The maximum integer value in set1 is: 1000
The minimum integer value in set2 is: 1
The set1 added by set2 is: 1001
The max_set1 is lessor than min_set2: False
The set1 difference to set2 is : {Decimal('1000'), Decimal('0'), Decimal('2')}
>>>

Comments