1. Basic data types

  1. Numeric type: integer type, floating point type, paraphrase type, boolean type

  2. string

  3. Container types: lists, tuples, dictionaries, sets

    picture


Integer type int, INT is an identifier used to define a variable of integer type. Contains four bases, namely binary, octal, decimal and hexadecimal. Computer storage is stored in binary, only 0 and 1 can be stored, other numbers cannot. Octal can only store up to 7.

picture

picture

picture


2. Operation

Operations include addition, subtraction, multiplication, division, exponentiation, integer division, and modulo (that is, taking the remainder)

picture


3. Boolean type

  • The boolean type has two values: true and false. true represents true, false represents false.

  • The boolean type is used to judge logical conditions and is often used for program flow control.

picture

  • int converts boolean to numeric, and bool converts numeric to boolean.

  • Strings cannot be converted to and from integer and boolean types.

picture

  • bool converts the value to a boolean, except 0, which is false, and all others are true.

picture

picture

picture

picture

3. Floating point

Floating point, can be understood as a decimal in mathematics.

picture

4. Plural types

Complex number (Complex) is a built-in type of Python, which can be written directly. In other words, the Python language supports complex numbers natively, without relying on the standard library or third-party libraries . A complex number

picture

picture