1. A variable is an area of computer memory where a variable can store values within a specified range, and the value can be changed.
Constants are a read-only area of memory that cannot be changed once they are initialized.
In general, the simplest understanding is that Python's constants are mainly defined as immutable quantities in the course of a program's operation, and Python's variables are mainly those that can be changed in the course of program execution, and we don't have to delve into them.
A = 5print (a) #输出a为5a = 6print (a) #输出a为6
At this point a is the variable
Import Mathprint (Math.PI)
At this point, the output of pi is constant
2. Judgment statement
The simplest understanding is to judge a condition, what the condition does, and what the condition is not.
The most common is if------else-----and if----elfi-------eles-----
Score = 100if score > 90:print ("A") Elfi > Score > 80:print ("B") else:print ("C")
3. Cycle
Self-understanding is the constant execution.
Common while and for----in-----
A range (x) is filled with numbers used to generate 0-x.
While condition: execution
For I in range (x): Print (i)
The second study learned
For I in range (x): print ("xxxxx {0} {1}". Format (i, "xxxx") does not work well 4. Functions my understanding of functions is that functions can improve the modularity of applications and the reuse of code. For example a shopping system, need to recharge, you can write a recharge function, wait until the use of the direct import function can make the code simplified. Def Max (A, B): If a > B:return a else:return the size of a function, the value of output A is 5. Import function imports py name from PY name function name such as: a file called Do test1.py test1.py function as Max () function another file for test2.py in test2.py there is the function of Max () in test1.py import test2.py or form Test1 Import max himself video site: www.ldxzs.top No ads everyone's okay. You can step on the movies and the series.
Python Two-time learning (variable, judgment statement, loop, function, import *.py)