First, the history of programming languages
1. machine language
Advantages: calculated directly read the count, speed
Disadvantages: low efficiency of development
2. assembly language
Advantages: develop more efficient than machine language
Disadvantages: low efficiency compared to machine language
3. The high-level language
● Compiled
After a translation, you can get the translation of the results after multiple runs
Advantages: high development efficiency
Disadvantages: low efficiency
● interpreted
Line by line translation
Advantages: high development efficiency
Disadvantages: low efficiency
Learning curve
>>> >>> machine language, assembly language level language
effectiveness
>>> >>> machine language, assembly language level language
Development efficiency
>>> >>> high-level language assembly language machine language
python
1. Glue languages: Python for websites, desktop application development, automated scripts, complex computing systems, scientific computing, many aspects of life support systems management, networking, gaming, robotics, natural language processing.
2. Changeling Man: programmers can quickly call other people's code, make changes to achieve their purpose
In the IT industry, do not rush to try the latest version of the software! ! ! ! ! ! ! ! ! ! ! !
(The latest version will generally have bug)
pop-up windows + r small box, and then proceeds to dos interface, input box cmd
III. The first python program
Two ways to run the python program
1. Interactive
Pros: typing immediately a corresponding return results
Cons: Can not permanently stored data
2. Command Line
Advantages: can permanently store data
Cons: temporarily run the file to see a bit of trouble
To run a py file needs to go
1. The python interpreter code read from the hard disk memory
2. Your written py file from the hard disk into memory
3. The interpreter reads the contents explained py file, the computer can be interpreted to identify sentences
variable
1. What is variable
Amount: measure / record the state of things / features
Variable: Status / features can be varied
2. Why have variable?
Help you record a certain state of things or saving features
3. Definition of variables
Call (use) the variable must be defined variable names without the quotation marks
4. The three elements of variable
1.id():返回的是一串数字,这一串数字你可以理解为内存地址
2.type():返回的是该变量对应的数据类型
3.value():该变量指向的内存当中数据的值
5.小整数池()
>>> a = 257
>>> b = 257
>>> id(a)
2919979319120
>>> id(b)
2919979576208
>>> c = 256
>>> d = 256
>>> id(c)
1642892736
>>> id(d)
1642892736
注释是代码之母
垃圾回收机制
1.引用计数:内存中的数据如果没有任何的变量名与其有绑定关系,那么会被自动回收
2.标记清除:当内存快要被某个应用程序占满的时候,会自动触发
3.分代回收:根据值得存活时间的不同,划为不同的等级,等级越高垃圾回收机制扫描的频率越低
常量
python里面没有常量,开发过程中不可随意更改别人常量
通常将全大写的变量名看作常量