1.python
python It's an interpretive language , It's also a weakly typed programming language .
2. Variable
A variable is a name used to store data , Can be called multiple times during program execution .
2.1 Naming rules for variables
1. There are letters 、 Numbers 、 Underline composition
2. Cannot start with a number , It can't be pure numbers
3. It can't be a keyword
4. Case sensitive
Be careful
1. Variable names should not be too long
2. The variable name has to make sense
3. The variable name should not be in Chinese
4. It can be named hump and underline
Hump naming :ageSexFamel, Except for the first letter words, the first letters of other words are capitalized
Underline naming :age_sex_famel
3. data type
int ( Integer types ), You can do operations ,+, -, * ,/ ,%( Remainder ) ,//( integer )
str ( String type ), It can be spliced and repeated ,+ ( String splicing )*( Duplicate string ), Use single quotes , Double quotes , All three quotes are strings
bool( Boolean value ), Only True and False Two values
4. Conditional statements if else
- have only if Conditional statements
if Conditions :
Code block
The execution process is : When conditions hold , Execute code block
2.if && else
if Conditions :
Code block 1
else:
Code block 2
Execute the process , When conditions hold , Execute code block 1, Otherwise, execute the code block 2, Two inside execution 1 individual .
3.if && elif && else
if Conditions 1:
Code block 1
elif Conditions 2:
Code block 2
…
else:
Code block n
Execute the process : If the conditions are met 1, Just execute the code block 1, If the conditions are met 2, Just execute the code block 2, If all the conditions are not met , execute else The following code block , From the top down , Execute sequentially , If there are conditions , The program to stop .