Python Operator :< Less than <= Less than or equal to > Greater than >= Greater than or equal to == be equal to != It's not equal to is Judge two objects id Whether it is equal or not is not Whether two id It doesn't wait
Numeric type : Integers (integers) Floating point numbers (floating point numbers) The plural (complex numbers)
Python The integer length is not limited .
because Python Calculating floating-point numbers is inexact , for example :0.1+0.2 The result is 0.3000000000004,Python For accurate calculation, use decimal modular .import decimal a = decimal.Decimal('0.1') b = decimal.Decimal('0.2') ; You can also use e-05 Namely 0.00005, This is convenient for writing .
The plural : Real component + Imaginary part , for example x = 1+2j x.real The result is zero 1,x.imag The result is zero 2,.
Operations between integers :x + y Add x - y reduce x * y ride x / y except x // y Floor removal x % y Remainder -x x The opposite number of +x x In itself ads(x) x The absolute value of int(x) take x Convert to integer float(x) take x Convert to floating point complex(re, im) Returns a complex number ,re Real component im Imaginary part c.conjugate() return c Conjugate complex .
Floor removal : Ensure that the result of dividing two integers is an integer , Round down if not an integer