This section focuses on data types in the basics of Python, numbers and Boolean values
Introduce several points of knowledge:
1) The use of the built-in function print (), print the contents of the parentheses directly, or print followed by multiple outputs, separated by commas.
2) Built-in function type (), query the data type of the variable.
Use the following command to view the data type of the variable AAA
>>>print (Aaa,type (AAA))
1. Basic data type 1.1. Numbers
1) int (integer integers, integral type)
For example: 6 is an example of an integer.
2) long (Long integer type)
Long integers are larger integers.
Unlike the C language, Python's long integers do not refer to the positioning width,
That is, Python does not limit the size of long integer values, but in fact, because of limited machine memory, we cannot use a long integer value that is infinitely large.
Attention:
Since Python2.2, if an integer overflow has occurred, Python automatically converts the integer data to a long integer, so there is no serious consequence of not adding the letter L after long integer data.
On a 32-bit machine, the number of integers is 32 bits and the value range is -2**31~2**31-1, which is -2147483648~2147483647
On a 64-bit system, the number of integers is 64 bits and the value range is -2**63~2**63-1, which is -9223372036854775808~9223372036854775807
3) Float (floating point, float type)
3.23 and 52.3E-4 are examples of floating-point numbers.
The e tag represents a power of 10. Here, 52.3E-4 means 52.3 * 10-4.
A floating-point number is used to process real numbers, which are numbers with decimals. Similar to the double type in C, accounting for 8 bytes (64 bits), where 52 bits represent the bottom, 11 bits represent the exponent, and the remaining one represents the symbol.
4) complex (plural)
( -5+4j) and (2.3-4.6j) are examples of complex numbers, where -5,4 is a real number, j is an imaginary number, and what is the plural in mathematics?
The complex number consists of real and imaginary parts, the general form is X+yj, where x is the real part of the complex, and Y is the imaginary part of the complex, where x and y are real numbers.
Note: Small number pools exist in Python:-5 ~ 257
Expansion: complex numbers, real numbers, rational numbers, irrational numbers
Http://www.cnblogs.com/alex3714/articles/5895848.html
Rational number
Mathematically, a rational number is a ratio of an integer A to a nonzero integer b, such as 3/8, A/b, or a fraction. 0 is also a rational number. A rational number is a set of integers and fractions, and integers can also be considered as fractions of one denominator.
The fractional part of a rational number is a finite or a number of infinite loops. The real number that is not the rational number is called the irrational number, that is, the fractional part of the irrational number is the infinite loop.
Irrational number
Irrational numbers, also known as infinite repeating decimal, cannot write the ratio of two integers. If it is written in decimal form, the number after the decimal point is infinitely multiple and does not loop. The common irrational number has the square root of the non-complete square number, PI and E
Real
A real number, which is a general term for rational and irrational numbers
Floating point number
A floating-point number is a numeric representation of a number in a given subset of a rational number, which is used to approximate any real numbers in a computer. Specifically, the real number is obtained by multiplying an integer or fixed-point number (that is, the mantissa) by a radix (usually 2 in the computer), which is similar to the scientific notation of cardinality 10.
Scientific method of notation
A real number with an absolute value greater than 10 is recorded as a form of ax10n (1≤|a|<10,n is an integer), and this notation is called the scientific notation. This is a method of counting. such as 19971400000000=1.99714x10^13. The power of a calculator or computer to express 10 is usually E or E, or 1.99714e13=19971400000000
Plural
The plural refers to a number a+bi that can be written as follows, where a and b are real numbers, and I is the imaginary unit (that is, 1 open root). In complex A+bi, A is called the real part of a complex number, B is called the imaginary part of a complex number, and I is called the imaginary unit. When the imaginary part equals zero, the complex number is the real number, and when the imaginary part is not equal to zero, the complex number is called imaginary
2. Boolean values
True or False
1 or 0
Finished, hehe hehe
Basic knowledge of Python basics -03.python