#Don't be salted fish Day 2 Learn simple Python and do German reading

Learn Python3 grammar today

**

List only the differences

**
1. Number (Number)
There are four types of numbers in python: integers, booleans, floating-point numbers and complex numbers .
complex (plural), such as 1 + 2j, 1.1 + 2.2j
2. Line and indentation
The most distinctive feature of python is the use of indentation to represent code blocks, without the need to use braces {}. Python usually writes a statement on one line, but if the statement is very long, we can use the backslash () to implement a multi-line statement.
A blank line is used to separate functions or methods of a class, indicating the start of a new piece of code. A blank line is also used to separate the class and function entries to highlight the beginning of the function entry.
Blank lines are not part of Python syntax, unlike code indentation. No blank lines are inserted when writing, and the Python interpreter runs without error. However, the role of blank lines is to separate two pieces of code with different functions or meanings, which is convenient for future code maintenance or refactoring.
Remember: blank lines are also part of program code.
3. String (String)
The use of single and double quotes in python is exactly the same.
Use triple quotes ("' or """) to specify a multi-line string.
Escape character '\'
backslash can be used to escape, use r to make backslash not escape. . Such as r"this is a line with \n" then \n will be displayed, not a newline.
Concatenated strings literally, such as "this" "is" "string" will be automatically converted to this is string.
Strings can be concatenated with the + operator and repeated with the * operator.
Strings in Python are indexed in two ways, starting with 0 from left to right, and starting with -1 from right to left.
Strings in Python cannot be changed.
Python does not have a separate character type, a character is a string of length 1.
The grammatical format of string interception is as follows: variable [head subscript: tail subscript]
4. import and from…import
Use import or from…import to import the corresponding module in python.
Import the entire module (somemodule) in the format: import somemodule
Import a function from a module in the format: from somemodule import somefunction
Import multiple functions from a module in the format: from somemodule import firstfunc, secondfunc, thirdfunc
imports all functions in a module in the format: from somemodule import *
The number of indented spaces is variable, but the statements of the same code block must contain the same number of indented spaces.


Supplement to Mathematical Knowledge
Hessian Matrix - Determining the extreme value of a multivariate function is one of the mathematical foundations of the gradient descent method that is often mentioned.
"Numerical Linear Algebra", edited by Xu Shufang.


Gossip
found out today that getting a Korean visa is quite a hassle...hope you don't have to actually go to Korea.
And after listening to a LIVE, https://www.zhihu.com/lives/822137901210009600/messages , it is very useful for any student eigentlich who is involved in more than three languages ​​/ interested in translation.
For example, what level do you have as a part-time translator, and what is your salary
? CATTI is really awesome

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324482394&siteId=291194637