day2 Python Programming ⼊ Enter into ⻔ Door operation
choice question
Which of the following statements is in Python It's illegal ?(B) A. x = y = z = 1 B. x = (y = z + 1) C. x, y = y, x D. x = y
About Python Variable , The following statements are wrong (C) A. Variables don't need to be typed B. Variables can be reassigned C. Variable ⽆ You must first create and assign ⽽ Direct use ⽤ D. The same variable can hold different types of values
Next ⾯ Which is not Python Legal identifier (B) A. int64 B. 40XL C. self D. stu_name
The following about Python language ⾔ It's wrong to say (C) A. Python It's interpreted language B. Python yes ⾯ Speak to the object ⾔ C. Python2.x and Python3.x Is fully compatible D. ordinary ⽂ This editor can also write Python Program
The following about print Function usage is wrong (D) A. print(100) B. print(100, 200) C. print(100, ‘hello world!’) D. print(10 20)
Completion
Python The symbol for a single line note in is ( # ), many ⾏ The symbol of the note is ( ‘’’ ‘’’ and “”" “”" ).
sentence a, b=10,20 Of board ⾏ after ,a The value of is ( 10 ); sentence a, a = 10, 20 Of board ⾏ after ,a The value of is ( 20 ).
Python The program file extension is ( .py ).
stay Python in ,int The data type represented is ( integer ).
stay Python in , String data needs ⽤( " " ) or ( ’ ’ ) The parcel .
stay Python in , Boolean types have ( 2 ) It's worth , Namely ( True and False ).
If you want to see ⼀ The data type of a data or variable , It can be used ( Type() ) function .
Programming questions
Write program tips ⽤ User input ⽤ Account name and password , And will lose ⼊ The contents of are saved to different variables .
name = input(" Please enter a user name :")
password = input(" Please input a password :")
print(name)
print(password)
send ⽤ One print Output 3 Data ,3 There's data in ⼀ Row display , And use the equal sign (=) separate .
a = 15
b = 30
c = 6
print(a, b, c, sep="=")
Short answer
When declaring variables , What are the precautions for variable names ?
Do not use the system function name 、 Class name and module name
The condition of the identifier must be met , But you can't use reserved words
Try to see the text and understand the meaning , It can let others understand what data the variable stores
Please write out Python What are the advantages of language .
The code is concise , Understandability
There are many modules
Strong expandability
Open source 、 free
Please write out Python often ⻅ Application fields of .
Artificial intelligence
Data analysis
web Development
Automated testing and automated operations
Write down the questions you have about today's lecture ( Or knowledge points that feel difficult ).