Python Basic notes-functions

Source: Internet
Author: User

Functions are well-organized, reusable pieces of code that are used to implement a single, or associated function.

The benefits are:
One can extract the relatively independent function module in the program, and reduce the writing of reread code;
Second, these functional modules can be reused in the future

Define a function

    1. You can define a function that you want to function, and here are the simple rules:

      • The function code block begins with a def keyword followed by the function identifier name and parentheses ().

      • Any incoming parameters and arguments must be placed in the middle of the parentheses, and the parentheses can be used to define the parameters.

      • The function content starts with a colon and is indented.

Python Basic notes-functions

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.