Python built-in data types include numbers, strings, lists, tuples, and dictionaries
1. Integral type and floating point type
As a result, the type of the variable can be changed, and when Python assigns a value to an already existing variable, it actually creates a new variable, even if the variable name is the same, but their identity is different, and the identity can be output with the ID function.
2. Boolean type
Boolean for logical operations, there are two values true and false, the identity of the true and false, actually with Java nothing
Difference
3.Python operator
(1) The arithmetic operators used in Python are basically the same as the operators in mathematics, with + 、-、 *,/
and parentheses, the order of operations is first multiplication after the addition and subtraction, the parentheses precedence calculation. Here are a few examples to illustrate:
(2) There are two arithmetic operators are% and * *, (modulo operation and exponentiation), modulo operation is to take the remainder, the power operation is a result of a multiplicative, the sample code is as follows
I'm not saying much here. It's easy to understand, to add that Python is not supported by the self-increment operator + + and the self-decrement operator.
Use of 4.Python strings
(1) There are three ways to represent a string in Python: single quotes, double quotes, and three quotes, as shown in the following example:
(2) Other uses of strings
Python strings can be multiplied by multiplying an integer and a string, such as the number 6 by the string ' A ', the structure is the string aaaaaa, equivalent to string a copied 6 times, the code is as follows:
Python Common data types