Python Integer Operation example: Boolean, standard, and long
This article describes the Python integer operations such as Boolean, standard, and long. We will share this with you for your reference. The details are as follows:
# Coding = utf8def integerType (): ''' Boolean: The value ranges from True (1) to False (0) ''' Tbool = True Fbool = False print "The True is stand for % d" % (Tbool) print "The False is stand for % d" % (Fbool) print ''' python standard Integer type: Python standard Integer type is the most common numeric type. On most 32-bit machines, the value range of the standard Integer type is-2147483648 to 2147483647. The Python standard Integer type is equivalent to the signed long integer type of C. The octal integer starts with the number "0. The hexadecimal integer starts with "0x" or "0X" and '''bint = 010101 dInt = 84455555 oInt = 075 hInt = 0 xabc print "the binary of The standard integer :", bInt print "The decimal of the standard integer:", dInt print "The octal of the standard integer:", oInt print "The hexadecimal of the standard integer :", hInt print ''' python long integer: the value that can be expressed by a Python long integer is only related to the (virtual) memory size of the machine value. A long integer is a superset of the standard Integer type. Add an L after an integer (either in upper or lower case). We recommend that you use uppercase to avoid confusion with number 1. This integer can be in decimal, octal, and hexadecimal notation. Only calls repr () to a long integer can see L, and CALLS str () to a long integer cannot see L. Integer and long integer are unified into one type. '''Blong = fig = 8888888888888888888888888888888888888888888888L oLong = export hLong = print "The binary of the long integer:", repr (bLong) print "The decimal of the long integer: ", repr (dLong) print" The octal of the long integer: ", repr (oLong) print" The hexadecimal of the long integer: ", repr (hLong) print ''' call the function: integerType () ''' integerType ()
The running result is as follows:
PS: Here are some recommended computing tools for your reference:
Calculation tool for online mona1 functions (equations:
Http://tools.jb51.net/jisuanqi/equ_jisuanqi
Scientific calculator online use _ advanced calculator online computing:
Http://tools.jb51.net/jisuanqi/jsqkexue
Online calculator _ standard calculator:
Http://tools.jb51.net/jisuanqi/jsq