python History
Garbage collection mechanism garbage collection
2004 WEB framework Django was born
python2:
The source code is not uniform, there are duplicate function code
python3:
Source unity there is no duplication of function code
python is a kind of language
- Compiled: translated only once (representative C)
- Pros: Fast
- Disadvantages: slow development
- Interpreted: Progressive translation (representative python)
- Cons: Slow execution
- Pros: Fast Development
- Compiled: translated only once (representative C)
python species
- cpython
- Jython
- IronPython
- (Special) Research PyPy
Variables - output,
What is variable
The (intermediate value storage) a temporary value stored in memory
Variables can do
Variables can be reused
How to use variables that with frequent use -----
a=1#声明变量 #a ---变量名字 #= ---赋值操作 #1 ---值
Variable definition rules
Variable names consists of numbers, letters, underscores
You can not begin with a number
You can not use python keywords
You can not use Chinese and Pinyin
Case sensitive
To descriptive variable names
Recommended wording
- Hump body AgeOfOldboy = 98
- Underline age_of_oldboy = 98 (the official recommended)
print print output
Senior variable small
# age=11 # age1=12 # age2=age # age=13 # print(age,age1,age2) # a=4 # b=a+6 # print(b)
Constant default all caps
Year-round constant amount, constant declaration in the configuration file
Notes - explain their code, the content of the comment is not performed
- Single-line comments (when line comments) #
- Multi-line comments '' '' '' or "" "" "" in front of the head must write
The data type determines the type of base
Int type is used to calculate it would be more
Strings and string str only do addition, can not do with digital multiply python as long as subtraction and division caused by the string is a quoted
Boolean value bool: True False determine the true and false
Plus +
Less -
Take *
In addition to /
- What is the basis of type?
- Type of foundation is doing?
- The basis of the type that use?
Enter the input user interaction
- input ( "precautionary statements")
- Python3 content acquired all of the input string
- int () converts the digital string into full
- str () conversion by the variable force string type
- type View data types
if --- if a keyword in python
if True: #结果
if
if else a second election
if 空格 条件 : 缩进 结果 else : 缩进 结果
if (if) elif (if re) selected from a plurality elif or not selected
if elif elif else a multiple-choice
if if if multiple choice
if the general write three nesting
Variable flow control
Guess you like
Origin www.cnblogs.com/ciquankun/p/11132741.html
Ranking