python basic grammar 5

Global Variables
global reserved words

1. The position of the transmission parameters

2. Keyword transfer

Keyword (keyword) parameter passed is passed under the name of each parameter. Keyword does not comply with the correspondence between locations.

  1. def fun(a,b,c)
  2.   return a+b+c
  3. print(f(1,c=3,b=2))


3. The default parameter values

When the function definition, the use of the form c = 10 embodiment, may be given a default value (default) to the parameters. If the final parameter value is not transmitted, default values ​​will be used.

  1. def f(a,b,c=10):
  2.   return a+b+c
  3. print(f(3,2))
  4. print(f(3,2,1))


When the first call to the function f, we do not have enough value, c is not assigned, c will use the default value of 10. The second call function of time, c is assigned the value 1, no longer uses the default value.

4. Package delivery / collection parameters

You can pass any parameters

5. unwrapping

Class
and instance of the class Python
object-oriented concept is the most important class (Class) and instance (Instance), must bear in mind the class is abstract template, which is a class instance is created out of a concrete "objects", each object We have the same approach, but their data may be different.

Class package
package, by definition is the contents of the package somewhere, we go after the call content is encapsulated in somewhere.

Method class
within the class, the use of def keyword to define a method, different from the general definition of the function, class method must contain parameters self, and is the first parameter, representative of the Self are instances of classes.

Inherited classes
defined parent class

Subclass inherits the parent class

(Time constraints, no more than your own knowledge involved to find relevant information)

You will be self-study content:

(If necessary and then sum)

# Dictionary get method

lambda function usage

format function

reduce function

filter function

time library

datetime library

jieba Library -> Frequency Statistics -> word cloud

Use file

Regular Expressions

About machine learning algorithm:

Linear regression logistic regression

KNN (K - Nearest Neighbor algorithm)

Naive Bayes SVM

Decision tree K- means algorithm

Random Forest dimensionality reduction algorithm

Gradient Boosting algorithm and AdaBoost

Guess you like

Origin www.cnblogs.com/xnsx/p/12513722.html