python Interpreter : take python The code is translated into a language that the machine can understand , And execute the code .
Pycharm:python Code editor .
A variable is an area of memory .
Variable name : In letters , Numbers and underscores make up , Cannot start with a number .
python in , There is no need to set the type when defining variables .
1、 value type
python Supported by 5 Types :int integer ,float floating-point ,bool type ,complex Plural
Long integers now fall into int integer .
In particular, the value specified in the scientific counting method is counted as floating point type
bool Type return ture perhaps false
2、 Cognitive operator
1) Arithmetic operator : +,-,*, **,/,%,//
among ** Representative power ,% For taking the rest ,// It stands for division .
2) Assignment operator :=,+=,-=,l=,*=,%=
Specific reference examples
3) Relational operator :>,>=,<,<=, !=,==
among = For assignment ,== For judgment .
4) Logical operators : Logic and and, Logic or or, Logic is not not
among , Logic and , The whole is true , One false is true .
Logic or , All false is false , One is true .
Logic is not , False is true , True is false .
Examples of arithmetic operators
Example of assignment assignment operator
Examples of relational operators
Return to bool value
Examples of logical operators
1、input For input
2、 Convert data type
int() Convert data to integer
float() Convert data to floating point
bool() Convert data to Boolean
use int Define input
Does not define int, Direct comparison error
Definition int after , It can be compared with the numerical value
3、 Output
%s character string ,%d Integer is placeholder
.xf Represents the decimal places omitted to the floating-point point
You can also use format Format printing