list Sequence type : Data has positional order
Representation :[data1,data2,…]
a = [1,2,3,4,5]
a[0]
Representation : (data1,data2,…)
Element does not support modification
b = {
1,2,3,4}
b[0]
Mapping type : adopt “ key ”-“ value ” Data storage and search are realized by mapping
Representation :{key1:value1,key2:value2,…}
students = {
202001:" Xiao Ming ",202002:" Xiaohong ",202003:" The small white "}
students[202001]
A set of unequal elements , A disorderly
Representation :{data1,data2,…}
Hump body : Class name (AgeOfStudent)
Underline : Variable name and function name
Constant , All letters are capitalized
Incremental assignment
x += 10
Package assignment
x,y = 1,2
print(x,y)
x,y = y,x
print(x,y)
Control process
Sequential process
Circulation process
form :for Elements in Iteratable object
Execute statement
Execution process
From iteratable objects , Remove each element at once , And carry out the corresponding operation
res = 0
for i in [1,2,3,4]
res += i
res
while Judge the condition
i = 1
res = 0
while i <= 5:
res += i
i += 1
res
Line break
print(123,end=" ")
print(456)
PI = 1
X = 5
print("PI - ",PI,"X = ",E)
format
1.
print(“PI = {0}, E = {0}”,format(PI,E))
2. Fill output
print(“{0:_^20}”,format(PI))
3. Digit thousands separator
4. Simplified output of floating point numbers
Use spaces