a python introduction.
1.Founder: GDO van rosu \ (Guido van Rossum).
3.The main application areas are: cloud computing, WEB development, artificial intelligence, system operation and maintenance, financial affairs, etc. graphics GUI.
4.It’s a door Dynamic interpretive interpretation A Strong type Define language.
☛Compiled type: It is to compile every statement of the source program into a machine language and save it as a binary file, so that the computer can run the program directly in machine language. Superior [In general, there is a pre compiled process to optimize the code, which is efficient and can run independently from the language environment. Deficiency [To modify the trouble needs to modify the whole module,]
☛Explanatory type : It is only when the program is executed that the machine language is interpreted as a machine language for the computer to execute slowly, because the computer can not recognize and execute the sentences we write, and it only knows the machine language (binary form). Superior [Good platform compatibility can run in any environment, flexible code changes.lack [Every time you run it, you have to explain it,]
☛dynamic : When you compile in a dynamic type language, you never need to specify a data type for any variable. The language records the data type within the Python when you first assign a variable to a variable (Ruby).
☛static state : When writing programs, declare the data type of all variables (C *, C++, C#, JAVA).
☛Strong type: A language that forces data type definitions. Once a variable is assigned a data type, if it is not coerced, it will always be the data type.
☛Weak type : A data type can be ignored in a language, and a variable can assign values to different data types.
5.Advantage: “It is clear that it is simple. Development efficiency is high; An advanced language.PortabilityExtendableCan be embedded.
6.Disadvantages: speed is slow, the code can not be encrypted. The thread can not take advantage of the multi CPU problem.
7.pythonInterpreter:CPython \ IPthon(Interactive) PyPY (execution speed) Jython / Java (IronPython) (cross platform)
two Python development history
2010Year 2.7, 2011, 3.2, 3.2, 2012, 3.3, 2014, 3.4, 2015, 3.5.
1.Variables are formed by the combination of letters and numbers.
2.You can’t start with numbers, not full numbers.
3.Can not be the keywords of Python. These symbols and letters have been occupied by Python and can not be changed.
4.Don’t use Chinese.
5.Not too long;
6.The name must be meaningful; ‘
7.It is recommended to use “Hump” (except for the initials of each word except the initials).
There is no absolute constant in Python, and the capitalized letters are constants.
Single line notes# The content of the annotated;
Multiline notes ” ” “aaaaaa” ” “ \ ‘ ‘ ‘ Annotated content ‘ ‘ ‘ Also called “document annotation”.(Shortcut key Ctrl+? \ \ \)
The basic data type of six Python
2.STR: Strings can be quoted by single quotation marks, double quotation marks, or three quotes.
Join s1=’: a S2, S2, #print = (S1 + S2)
Multiplying: STR, int, name, = “strong” print (name * 8)
3. Boolean value (bool) True and False
Seven user interaction
Using the input () function, we can interact with computers.
Eight process control – if – statement
1. If Conditions:
Results 1#Four spaces, or a Tab key,
Results 2# If the condition is true execution result 1, then the result is 2; if the condition is false, the direct execution result is 2..
2. If Conditions: (There are only two options)
3. If Condition 1:
elif Condition 2:
4. If Conditional 1:
If Condition 2:
Nine process control – while – loop statement
1. while True ( 1 )) : ( Dead cycle
print( …. )
print( …… )
print( …… )
2. while Conditions: (Conditional circulation
Result # Conditions really execute the result, and then judge the condition until the condition is false, stop the cycle.
Termination of the cycle: Break.
Ten process control – break – and – continue
1. break : Immediately jump out of the cycle and interrupt the cycle.
2. continue : Stop this cycle and continue the next cycle.