Python Introductory Tutorial Series: Second, function

Source: Internet
Author: User

the functions in Python are simple, the basic principles are the same as C or Java, there are some differences in individual details, but usually do not affect the normal use of small white players, such as the C hollow return type Void,python is None , the first declaration of the function after use, etc. in Python is one, do not need to be as strict as the need to declare in C. Python doesn't need that much "extra" work. Some concepts, such as formal parameters and arguments, are similar to those in C and Java.

The use of functions in Python is also simple, using DEF to define functions.

>>> def hello ():
... print ' Hello World '
>>>
>>> res = hello ()
Hello
World

the content of the function is relatively few, the content of the textbook gives more, but a lot of content uses not many, the interest oneself research research study, as well as later chapter "module", "module" This part knows how to import the module to be enough,

Import * * * * * and from***import*** Two forms of usage browse it almost.

Python Introductory Tutorial Series: Second, function

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.