int (integer) function

Source: Internet
Author: User

class int (object):
"""
Int (x=0), int or long
int (x, base=10), int or long

Convert a number or string to an integer, or return 0 if no arguments
is given. If x is floating point, the conversion truncates towards zero.
If x is outside the integer range, the function returns a long instead.

If x is not a number or if base is given, then x must a string or
Unicode object representing an integer literal in the given base. The
Literal can is preceded by ' + ' or '-' and is surrounded by whitespace.
The base defaults to 10.  Valid bases is 0 and 2-36. Base 0 means to
Interpret the base from the string as an integer literal.
>>> int (' 0b100 ', base=0)
"""
def bit_length (self):
"" Returns the minimum number of digits used to represent the number ""
"""
Int.bit_length () int

Number of bits necessary to represent self in binary.
>>> Bin (37)
' 0b100101 '
>>> (PNS). Bit_length ()
"""
return 0
Print (Int.bit_length (12))
4

def conjugate (self, *args, **kwargs): # Real Signature Unknown
"" Returns the conjugate plural of the complex number "" "
"" "Returns self, the complex conjugate of any int." "" "
Pass

def __abs__ (self):
"" Returns the absolute value "" "
"" "X.__abs__ () <==> abs (x)" ""
Pass
Print (int.__abs__ (12))
12

def __add__ (self, y):
"" "X.__add__ (y) <==> x+y" ""
Pass
Print (int.__add__)
3 Add

def __and__ (self, y):
"" "X.__and__ (y) <==> x&y" ""
Pass
And

def __cmp__ (self, y):
"" "Compare two number Size" ""
"" "X.__cmp__ (y) <==> cmp (x, y)" ""
Pass

def __coerce__ (self, y):
"" To force the generation of a tuple "" "
"" "x.__coerce__ (y) <==> coerce (x, y)" ""
Pass



def __divmod__ (self, y):
"" "divides, obtains the quotient and the remainder constituent tuple" ""
"" "X.__divmod__ (y) <==> divmod (x, y)" ""
Pa
Print (int.__divmod__)
0,1 1/2 equals 0 more than 1

def __div__ (self, y):
"" "X.__div__ (y) <==> x/y" ""
Pass


def __float__ (self):
"" is converted to floating-point type "" "
"" "x.__float__ () <==> float (x)" ""
Pass
Print (int.__float__ (1))
1.0

def __floordiv__ (self, y):
"" "X.__floordiv__ (y) <==> x//y" ""
Pass
Print (int.__floordiv__ (10,5))
2 divisible

def __format__ (self, *args, **kwargs): # Real Signature Unknown
Pass


def __getattribute__ (self, name):
"" "x.__getattribute__ (' name ') <==> x.name" ""
Pass


def __getnewargs__ (self, *args, **kwargs): # Real Signature Unknown
"" "Internal call __new__ method or create object when incoming parameter uses" ""
Pass

def __hash__ (self):
"" If the object is a hash table type, returns the hash value of object. The hash value is an integer. In dictionary lookups, hash values are used to quickly compare the keys of a dictionary. Two values if equal, the hash value is also equal. """
"" "x.__hash__ () <==> hash (x)" ""
Pass

def __hex__ (self):
"" Returns the hexadecimal representation of the current number "" "
"" "x.__hex__ () <==> hex (x)" ""
Pass

def __index__ (self):
"" for slicing, number meaningless "" "
"" "X[y:z" <==> x[y.__index__ (): z.__index__ ()] "" "
Pass
def __init__ (self, x, base=10): # Known special case of int.__init__
"" "constructor, automatically called when executing x = 123 or x = Int (10), temporarily ignoring" ""
"""
Int (x=0), int or long
int (x, base=10), int or long

Convert a number or string to an integer, or return 0 if no arguments
is given. If x is floating point, the conversion truncates towards zero.
If x is outside the integer range, the function returns a long instead.

If x is not a number or if base is given, then x must a string or
Unicode object representing an integer literal in the given base. The
Literal can is preceded by ' + ' or '-' and is surrounded by whitespace.
The base defaults to 10.  Valid bases is 0 and 2-36. Base 0 means to
Interpret the base from the string as an integer literal.
>>> int (' 0b100 ', base=0)
# (copied from class Doc)
"""
Pass

def __int__ (self):
"" is converted to an integer "" "
"" "x.__int__ () <==> int (x)" ""
Pass
Print (int.__int__ (1))


def __invert__ (self):
"" "x.__invert__ () <==> ~x" ""
Pass

def __long__ (self):
"" is converted to a long integer "" "
"" "x.__long__ () <==> Long (x)" ""
Pass
Int._long_ (11232)

def __lshift__ (self, y):
"" "X.__lshift__ (y) <==> x<<y" ""
Pass
Print (int.__lshift__)
4 Power, Second square

def __mod__ (self, y):
"" "X.__mod__ (y) <==> x%y" ""
Pass
Print (int.__mod__ (11,5))
Take the remainder

def __mul__ (self, y):
"" "X.__mul__ (y) <==> x*y" ""
Pass
Print (int.__mul__ (2,3))
Multiplication

def __neg__ (self):
"" "x.__neg__ () <==>-X" ""
Pass
Print (int.__neg__ (5)) converted to negative

@staticmethod # known case of __new__
def __new__ (S, *more):
"" "T.__new__ (S, ...) A new object with type S, a subtype of T "" "
Pass


def __nonzero__ (self):
"" "x.__nonzero__ () <==> x! = 0" ""
Pass

def __oct__ (self):
"" "returns the octal representation of the change value" ""
"" "X.__oct__ () <==> Oct (x)" ""
Pass


def __or__ (self, y):
"" "X.__or__ (y) <==> x|y" ""
Pass
Or

def __pos__ (self):
"" "x.__pos__ () <==> +x" ""
Pass


def __pow__ (self, Y, Z=none):
"" "Power, Second party" ""
"" "X.__pow__ (y[, z]) <==> pow (x, y[, z])" ""
Pass
Print (int.__pow__ (2,8))


def __radd__ (self, y):
"" "X.__radd__ (y) <==> y+x" ""
Pass
Print (int.__radd__ (5,6)) 11 Plus

def __rand__ (self, y):
"" "X.__rand__ (y) <==> y&x" ""
Pass
Print (int.__rand__ (100,2)) and

def __rdivmod__ (self, y):
"" "X.__rdivmod__ (y) <==> divmod (y, x)" ""
Pass
Print (int.__rdivmod__ (10,2)) 0,2


def __rdiv__ (self, y):
"" "X.__rdiv__ (y) <==> y/x" ""
Pass


def __repr__ (self):
"" "translates to the interpreter's readable form" ""
"" "x.__repr__ () <==> repr (x)" ""
Pass
Print (int.__repr__ (1))

def __str__ (self):
"" "to the form of human reading, if there is no suitable for people to read the form of interpretation, then return to the form of the Interpreter class reading" "
"" "x.__str__ () <==> str (x)" ""
Pass
Print (int.__repr__ (1))

def __rfloordiv__ (self, y):
"" "X.__rfloordiv__ (y) <==> y//x" ""
Pass
Divisible

def __rlshift__ (self, y):
"" "X.__rlshift__ (y) <==> y<<x" ""
Pass
Print (int.__rlshift__) 4 right arithmetic, octal right shift 2 bit

def __rmod__ (self, y):
"" "X.__rmod__ (y) <==> y%x" ""
Pass
Print (int.__rmod__ (3,10)) 1 take remainder

def __rmul__ (self, y):
"" "X.__rmul__ (y) <==> y*x" ""
Pass
Print (int.__rmul__ (2,4)) 8 times

def __ror__ (self, y):
"" "X.__ror__ (y) <==> y|x" ""
Pass
Print (int.__ror__ (2,3)) 3 transposition and operation

def __rpow__ (self, x, Z=none):
"" "Y.__rpow__ (x[, z]) <==> pow (x, y[, z])" ""
Pass


def __rrshift__ (self, y):
"" "X.__rrshift__ (y) <==> y>>x" ""
Pass
Left operator

def __rshift__ (self, y):
"" "X.__rshift__ (y) <==> x>>y" ""
Pass
Print (int.__rrshift__ (2,16)) 48 Binary right Shift operation

def __rsub__ (self, y):
"" "X.__rsub__ (y) <==> y-x" ""
Pass
Print (int.__rsub__ (2,5)) 3 subtraction

def __rtruediv__ (self, y):
"" "X.__rtruediv__ (y) <==> y/x" ""
Pass
Print (int.__truediv__ (10,2)) 5.0 Division

def __rxor__ (self, y):
"" "X.__rxor__ (y) <==> y+x" ""
Pass
Print (int.__rxor__ (2,8)) addition

def __sub__ (self, y):
"" "X.__sub__ (y) <==> x-y" ""
Pass
Print (int.__sub__ (5,3)) 2 subtraction

def __truediv__ (self, y):
"" "X.__truediv__ (y) <==> x/y" ""
Pass
Print (int.__truediv__ (5,2)) 2.5 division

def __trunc__ (self, *args, **kwargs):
"" "returns a value that is truncated to an integer that is not meaningful in shaping" ""
Pass

def __xor__ (self, y):
"" "X.__xor__ (y) <==> x^y" ""
Pass

Denominator = Property (Lambda self:object (), Lambda-Self, v:none, lambda self:none) # Default
"" "Denominator = 1" ""
"" "The denominator of a rational number in lowest terms" ""

Imag = Property (Lambda self:object (), Lambda-Self, v:none, lambda self:none) # Default
"" "imaginary, Meaningless" ""
"" "The imaginary part of a complex number" ""

Numerator = property (Lambda self:object (), Lambda-Self, v:none, lambda self:none) # Default
"" "Numerator = number Size" ""
"" "The numerator of a rational number in lowest terms" ""

Real = Property (Lambda self:object (), Lambda-Self, v:none, lambda self:none) # Default
"" "is no meaning," "
"" "The real part of a complex number" ""

Int

int (integer) function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.