The history of programming languages
1. machine language
Early programmers is the direct use of computers can read binary 0 and 1 write code, developed in this way is very inefficient, high efficiency.
0000,0000,000000010000 代表 LOAD A, 16
0000,0001,000000000001 代表 LOAD B, 1
0001,0001,000000010000 代表 STORE B, 16
0001,0001,000000000001 代表 STORE B, 1[1]
2. assembly language
On the basis of the machine language, adding a simple tag identification with binary numbers in English, but still partial underlying code, development efficiency is still low.
Print a hello world needs the code
; hello.asm
section .data ; 数据段声明
msg db "Hello, world!", 0xA ; 要输出的字符串
len equ $ - msg ; 字串长度
section .text ; 代码段声明
global _start ; 指定入口函数
_start: ; 在屏幕上显示一个字符串
mov edx, len ; 参数三:字符串长度
mov ecx, msg ; 参数二:要显示的字符串
mov ebx, 1 ; 参数一:文件描述符(stdout)
mov eax, 4 ; 系统调用号(sys_write)
int 0x80 ; 调用内核功能
; 退出程序
mov ebx, 0 ; 参数一:退出代码
mov eax, 1 ; 系统调用号(sys_exit)
int 0x80 ; 调用内核功能
3. The high-level language
Write directly to the people's language program, intermediate translation with translators.
Mainstream high-level languages include: PHP, C, C ++ java, python, go. Which is divided into two categories:
1. compiled language
Equivalent == == Google translation. Give you a full-time translator finished, but if you need to modify the middle of the place, but also re-translation. C language compiler language belongs
Advantages: high efficiency
Disadvantages: low efficiency of development
2. interpreted (the equivalent of a small secretary translation for you, say a translation)
This process requires the interpreter to use == ==. python belonging to an interpreted language
Advantages: high development efficiency
Disadvantages: low efficiency
4. In summary
Learning Difficulty ranking:
Machine Language> Assembly language> high-level language
effectiveness
Machine Language> Assembly language> high-level language
Development efficiency
Advanced Language> Assembly language> machine language
Two operation modes python program
1.cmd interactive.
The so-called interaction that you enter a content, it gives you a feedback. But the cmd accidentally closed if the content is lost
2. Command Line
To make up for the shortcomings of the interactive cmd can not permanently save the contents of the actual operation is to save the contents to your hard drive as a file, call the procedure need to use cmd window
ps: file extension
python file extension is .py, this is for the convenience of giving recognition python file and not the other
To run the python file
1. Start the python interpreter. The Python interpreter transferred from the hard disk into memory
2. Run the python file, there will be a python file on the hard disk into memory
3. Run the file on the python interpreter. Interpreter reads the file, the computer can be interpreted to understand the 0101100110001
IDE development editor
pycharm is a handy python development tools. Development can not pycharm
variable
1. What is a variable?
Variable is used to describe a feature things change
Rule 2. Use variables and the three elements of the variables?
After the variables must be defined in order to use; == == variable names can not add '' '' number.
Three elements:
1.id () memory address, an integer between -5 to 256, even though the much-quoted, the same memory address, because the python multiple applications in order to solve the low efficiency of the memory space to ask questions brought, some common data retention in memory, never to be cleared.
It refers to data type 2.type
3.value: refers to the value corresponding to the variable