First, comments
‘‘‘
Multi-line comments
‘‘‘
#单行注释
"' #example1.1 Test program time: 4/17/2017
I1=input ("Please enter user name:")
I2=input ("Please enter password")
Print (I1)
Print (I2)
Print ("ainiyou")
‘‘‘
Second, the variable
1) (the rules are the same as the rules in C)
2) cannot make python internal keywords
III. Basic data types
1) Number
Age=24
2) string
Name= "Yuanguoliang"
Name= 'Yuanguoliang'
Name= "" "Yuanguoliang" ""
3) Boolean value (True,false)
Iv. Process Control and indentation
1) If the indentation under the if must remain consistent
If condition:
Content 1
Content 2
Else
Content 3
Content 4
Example1:
I1=input ("Please enter")
If i1==1:
Print ("haha")
Print (1111)
Else
Print ("Hehe Ride")
Print ("Yuanguo")
Example2:
Name=input ("Please name")
pssscode=input ("Please passcode")
If name== "Yuanguoliang" and pssscode= = "123456":
Print ("Yes")
Else
Print ("NO")
V. While loop and break, continue
1)
While condition:
Code
2) break jumps out of the loop, does not execute after the code
3) Continue is used to exit the current loop and continue the next cycle
‘‘‘
Python Learning Series (iii) Python Getting Started grammar rules 1