Old boy Python Advanced video tutorial resource sharing

Source: Internet
Author: User
Python, an object-oriented, interpreted computer programming language, was invented by Guido van Rossum in 1989 and the first public release was released in 1991. Python is purely free software, and the source code and interpreter CPython follow the GPL (GNU general public License) agreement. Python syntax is simple and clear, and one of the features is to force whitespace (white space) to be indented as a statement. Python has a rich and powerful library. It is often nicknamed the glue language and is able to easily connect a variety of modules made in other languages, especially in C + +. "Old boy Python advanced Operational Excellence Video Tutorial" takes you in-depth understanding of the Python language

Course Play Address: http://www.php.cn/course/568.html

The teacher's lecture style:

Teachers teach in a clear, well-organized, layered analysis, interlocking, rigorous argumentation, structural rigorous, with the logical power of thinking to attract students ' attention, with reason to control the course of classroom teaching. By listening to the teaching of teachers, students not only learn knowledge, but also receive the training of thinking, but also by the teachers rigorous study attitude of edification and infection

The more difficult part of this video is the Python function knowledge:

A friend of the C language is certainly familiar with the word function, which plays a vital role in any programming language where the function (which is, of course, called the method in some languages, has the same meaning). Check out the function usage in Python today.

I. Definition of functions

In some programming languages, function declarations and function definitions are distinguished (in these programming languages, function declarations and function definitions can appear in different files, such as C), but in Python, function declarations and function definitions are considered as one. In Python, the basic form of a function definition is as follows:

def function (params):    block    return Expression/value


Here are a few things to note:

(1) Use the DEF keyword in python to define the function without specifying the type of the return value.

(2) The function parameter params can be 0, one or more, the same, the function parameter also does not specify the parameter type, because in Python the variable is weak type, Python automatically maintains its type according to the value.

(3) The return statement is optional, it can appear anywhere in the function body, indicating that the function call executes to this end, if there is no return statement, it will automatically return none, if there is a return statement, but return does not follow the expression or value is returned to none. Let's look at two examples:

Def Printhello ():    print ' Hello '    def printnum (): For    I in range (0,10):        print I    return        def add (a , b):    return a+b    print Printhello () print printnum () print add

Two. Use of functions

After defining a function, you can use the function, but in Python it is important to note that forward references are not allowed in Python, that is, the function is not allowed to be called until the function is defined. See an example to understand:

Print Add def add (A, B):    return a+b

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.