1, what is the operating system
An operating system is a procedure between software and hardware.
2, why should have the operating system
(1) Control hardware
(2) The interface of the control hardware is made into a perfect interface for the user to use.
3, the three major components of the operating system
Application:
Operating systems: such as windows, Linux
Computer hardware
4. Classification of programming languages
(1) Mechanical language
(2) Assembly language
(3) High-level language: Divided into compiled c, interpreted Python
5. Two programs to execute Python
<1> Interactive
Pros: Debug Programs
Cons: Unable to save code
<2> command-line mode: Permanently save code Python3 D:\p1.py
6.Python executes three stages of the program: Python3 D:\p1.py
1. Start Python3 Interpreter First
2. The Python3 interpreter reads the file contents D:\p1.py from the hard disk into memory like a text editor
3. Python3 Interpreter explanation execution file code
Emphasis: Only the third stage recognizes the Python syntax
7. Variables
What is a variable: change (in the real state)
Volume (recording the real state, so that the computer as a person to identify the world of things)
Why you should have a variable:
The execution of the program is the change of all States.
Define variables:
Name= ' Egon '
Age=18
sex= ' Male '
height=1.81
weight=160
Define three parts of a variable:
1, variable name: To take the variable value, are required by the variable name name
2. Assignment symbol: Assignment value =
3, Variable value: That is, the stored data, used to record the real world state ' Egon '
Variable Naming conventions:
1, the variable name can reflect the status of the record of the variable value.
2, can only be numbers, letters, any combination of underscores.
3. Keywords cannot be called variable names.
Two styles of variable names
1, Hump body aegofoldboy=18---case variable name
2, underline age_of_oldboy=19----name for the variable name, the recommended use of underscores, simple and clear
Constant:
To define constants in Python, the full name of the variable name should be changed to uppercase
age_of_oldboy=19
Age_of_oldboy=19
Print (Age_of_oldboy)
8. Python Memory Management:
Reference count increased
x=10 #10身上的引用计算加1
Y=x # 10 on the body of the reference calculation plus 1
Reference count Reduction
X=11 #10身上的引用计数减1
del y #del的意思即是解除绑定, 10 minus 1 on the reference count.
Once the reference count is 0, it is garbage. will be automatically reclaimed by the Python garbage collection mechanism.
Python's built-in feature ID (), each variable value has its memory address, and the ID is used to reflect the value of the variable in memory location, memory address different ID. ID: Reacts to a value in one place in memory. *****
#x = "Egon"
y#= "Alex"
#print (ID (x))
#print (ID (y))
9. Three characteristics of a variable (* * * * *)
①x= ' Egon ' >
ID "print" (ID (x))
Type "Print (type (x))
Value "Print (x)
② determine whether the value is equal: = =
Name1= ' Egon '
Name2= ' Egon '
Print (name1==name2)
③ determine if ID is equal: is
x=11
Y=x
Print (x==y)
Print (x is y)
Summary: 1, the ID is equal, the value must be equal
2, the value is equal, but the ID is not necessarily equal
Id:
Type types
Value values
Demonstration:
>>> name= ' Egon '
>>> Print (name)
1964167301752
>>> ID (name)
1964167301752
>>>
>>>
>>> type (name)
<class ' str ' >
>>>
>>> Name
' Egon '
#==: The comparison is the value
s1= ' name:alex,age:73 '
S2= ' name:alex,age:73 '
>>> s1= ' name:alex,age:73 '
>>> s2= ' name:alex,age:73 '
>>> ID (S1)
1964167290288
>>> ID (S2)
1964167290504
>>>
>>> S1 is S2
False
>>> S1 = = S2
True
#is: Identity operation, Comparison of ID
>>> x=1
>>> y=x
>>>
>>>
>>> ID (x)
1894346208
>>> ID (y)
1894346208
>>> x = = y
True
>>> x is y
True
Constants: Constant Amount
age_of_oldboy=58
Operating system, programming language classification, variables, memory management, defining variables