1. Installation and configuration of Python
Official website Download PY3 installation package--and install the Py3 installation path in path in the native environment variable. Note, do not delete the original path content, is to add
CMD input python-v to see if the installation was successful
2. Hello Word
Create a project in the Encoding tool--Create a. py file (file ending in. py is a python type file)
The first line is typed in print (' Hello word ') whatever you want, "What do you write about?
Noun Explanation:
Standard library: There is no need to install the library. Can be used directly after introduction, using the standard library when using the method
Principle: Not 1 or 0, non-empty is true
3. Variables
The definition of variables in the Py is very provincial, with = on the line. For example: username = ' Yiso ' NOTE: = After the thing, as long as the string type, all must use single quotation marks or double quotation marks: "," ". This is also very well understood, so to speak, as long as it is not involved in the operation of the use.
For example, accept user input user name and password, password is also a string!! Do not think that a password consisting only of numbers without quotation marks, passwords do not participate in the operation, so use quotation marks! For example, to allow you to enter your age, this variable does not need to be quoted, since this age will participate in the operation.
Variable names can only be any combination of letters, numbers, or underscores. If you do not remember, think about your usual registered account when you give yourself to log in with the user name of most of the platform rules, this better remember, haha haha.
However, the first character of a variable name cannot be a number ~ ~ ~
4. Comment Code
Annotate multiple lines of code with a ctrl+/, or three single quotes
Comment The first line of code
Second line of code
The third line of code ""
5. Input and output
Print (') output,
Enter input to display the input,
Input types such as passwords need to introduce a standard library called Getpass, with Getpass
such as import Getpass
x =getpass.getpass (' Enter password bar ')
Print (' x ')
6. Condition Judgment
If else, nested if the condition is many. If ... elif elif ... else
Such as
If Package price <1000
Buy!
Elif Bag Price =1000
Buy! Buy! Buy!
Elif Bag >1000
Buy in installments!
Else
Don't buy!
6666666 understand, right? But it doesn't look like the other side is going to do it.
7. Circulation
While/for
Break represents the entire loop this is the end of the action, it's time to do the next thing.
Continue represents the end of the cycle, the next cycle, know meet the end of the entire cycle of conditions, or dry cycle this one thing.
8, write the code thing
When writing code, pay attention to indentation.
The same function, the less code written the better
Code readability and maintainability is high, do not use pinyin to define variables, only you can read ....
The code library that submitted it has SVN, git, and so on, and SVN has been a fire for a few years, and now it's git. As for why, I see that SVN is out of date, as to why the outdated, because the two tools are not the same principle
python-Getting Started