Python‎ > ‎Fraction‎ > ‎

Fraction.numerator()

http://www.adilwaseem.com/

Definition
The return with the numerator value.

Syntax
Fraction(x,y).numerator

Parameters
x=number

Examples
Return are:
 >>> Fraction(2.11).numerator
4751297606875873
>>> Fraction(2,4).numerator
1
>>> Fraction(3,7).numerator
3
>>> Fraction(3,2).numerator
3
>>> Fraction(2,3).numerator
2

__eq__
The equality tested here:
 >>> Fraction(2,3).numerator.__eq__(2)
True

__gt__
The return is tested whether the one value is greater than other.
 >>> Fraction(2,3).numerator.__gt__(2)
False

__ge__
The equal to:
 >>> Fraction(2,3).numerator.__ge__(2)
True

__le__
The returns are following:
 >>> Fraction(2,3).numerator.__le__(2)
True

__gt__
The value is:
 >>> Fraction(2,3).numerator.__gt__(2)
False

__mul__
The multiplication's return is:
 >>> Fraction(2,3).numerator.__mul__(2)
4

__truediv__
The fraction is divided by 2.
 >>> Fraction(2,3).numerator.__truediv__(2)
1.0

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

__sub__
The value is:
 >>> Fraction(2,3).numerator.__sub__(2)
0

__pow__
The fraction raised to power of:
 >>> Fraction(2,3).numerator.__pow__(2)
4

__abs__
The absolute value of the fraction is:
 >>> Fraction(2,3).numerator.__abs__()
2

__floordiv__
The fraction is divided by:
 >>> Fraction(2,3).numerator.__floordiv__(2)
1

__mod__
The return is:
 >>> Fraction(2,3).numerator.__mod__(2)
0

__neg__
The negative value of Fraction is:
 >>> Fraction(2,3).numerator.__neg__()
-2

__ne__
The fraction is not equal to:
 >>> Fraction(2,3).numerator.__ne__(2)
False

__xor__
The find the value:
 >>> Fraction(2,3).numerator.__xor__(2)
0


Comments