First acquaintance with python

What is a variable?

Variable: Temporarily store the intermediate results of the program for subsequent program calls.

What is a string type?

Data enclosed in quotes in python is a string. String type, also referred to as str type.

What is an int in python?

'int' represents a numeric type in python and is used for arithmetic calculations.

Classification of python

compiled

Compile the code all at once into a binary and then run it.

Advantages: high execution efficiency

Disadvantages: low development efficiency, not cross-platform

Representing language C

explanatory

The code is interpreted line by line, interpreted into binary, and then run.

Advantages: high development efficiency, can refer to third-party libraries, and can be cross-platform.

Representing language python

variable rules

1, must be letters, numbers, underscores, any combination.

2. It cannot start with a number.

3. It cannot be a keyword in python.

4. Be descriptive

5. The variable name should not be too long.

6. The variable cannot be in Chinese.

constant

Variables that remain unchanged, variables with all uppercase defaults are constants.

 

basic data type

int: number, integer, used for calculations.

str: string, in python, everything enclosed in quotation marks is a string. (regardless of single or double quotes)

bool : True False two states, determine the authenticity of the code.

while loop

How to terminate the loop

1. Change the condition

2, break (directly end the loop)

 

continue

End this cycle and continue to the next cycle.

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324974705&siteId=291194637