table numeric operators and functions tuples syntax description adds number and number subtracts from multiplies by divides by yalways produces float (or complex if or is complexx / divides by ytruncates any fractional part so always produces an int resultsee also the round(function produces the modulus (remainderof dividing by * raises to the power of ysee also the pow(functions - negates xchanges ' sign if nonzerodoes nothing if zero + does nothingis sometimes used to clarify code abs(xreturns the absolute value of divmod(xyreturns the quotient and remainder of dividing by as tuple of two ints pow(xyraises to the power of ythe same as the *operator pow(xyza faster alternative to ( *yz round(xnreturns rounded to integral digits if is negative int or returns rounded to decimal places if is positive intthe returned value has the same type as xsee the text table integer conversion functions syntax description bin(ireturns the binary representation of int as stringe bin( =' hex(ireturns the hexadecimal representation of as stringe hex( =' bcint(xconverts object to an integerraises valueerror on failure--or typeerror if ' data type does not support integer conversion if is floating-point number it is truncated int(sbaseconverts str to an integerraises valueerror on failure if the optional base argument is given it should be an integer between and inclusive returns the octal representation of as stringe oct(ioct( =' tuples